2016-07-31 7 views
0

Wenn ich versuche, die scrapy Artikel als json zu speichern i Fehler wie diese:kann nicht scrapy Artikel serialisiert

TypeError: {'commitment': u'6 hrs/total', 


'course_id': 5098, 
'course_image_url': u'https://instructure-gallery.s3.amazonaws.com/production/products/965fe31a3fd1817ac9bec2d1628c8a62263341ac-thumb.jpg?1464928700', 
'course_type': u'Course', 
'credential': u'None', 
'date': u'Self-paced', 
'description_html': [u'<div class="main-column col-md-8">\n\t\t<h3>Description</h3>\n\t\t<p>Now that you\u2019re effectively blending/personalizing your own classroom, it\u2019s 
time for you to take the next step to become a blended leader and share your work with your school, district, and community. This course provides tools to help you begin that pr 
ocess, including:\n</p>\n<ul>\n<li>Case studies featuring schools that have started to extend their blending\n</li><li>Resources to start building your skill set as a blended lea 
der\n</li><li>Tips to focus your future goals and build action steps today\n</li><li>Suggestions for conferences to attend\n</li><li>Examples for using social media to improve an 
d share your practice\n</li><li>Ways to engage teachers and parents in this work</li></ul>\n\n\n\t\t<h3>Objectives</h3>\n\t\t<p>In this course, participants will:</p><ul>\n<li>Ex 
plore resources to build skills to become a blended leader and extend their reach.\n</li><li>Put together a timeline of their current blended journeys and future goals, including 
action steps to extend blending in their schools and/or communities. </li>\n\n\n\t</ul></div>'], 
'duration': u'Ongoing', 
'instructors': {'bio': u'Juliana Finegan is the Director of Personalized Learning at Relay Graduate School of Education. With support from TLA, Juliana, a former classroom teach 
er, developed four courses that support teachers and leaders to shift to blended and personalized learning models. Juliana has observed best practices all over the country, captu 
red strong blended footage, identified common denominators of implementation, and named key strategies that can be used immediately.', 
'image_url': u'http://pub-images.canvasnetwork.com/CN-2108-headshot-Juliana-Finegan.jpg', 
'name': u'Juliana Finegan', 
'subtitle': u'Professor'}, 
'is_free': True, 
'name': u'BL-201: Extending Your Blending', 
'organisation_image_url': u'https://instructure-gallery.s3.amazonaws.com/production/logos/b69b743bccd600578078628d50f8af69b088d39b.jpg?1465424854', 
'organisation_name': u'Relay Graduate School of Education', 
'price': u'$0', 
'requirement': u'None', 
'short_description': u'You\u2019re currently blending your curriculum and have seen how personalization helps push student growth, agency, engagement, and much more. Now it\u201 
9s your turn to start sharing your best practices, become a blended leader, and extend your reach.', 
'spider': 'canvas', 
'url': u'http://www.canvas.net/browse/relay/courses/extending-your-blending'} is not JSON serializable 

Allerdings, wenn ich die dict nehmen, das sagt nicht serializable aus dem Fehlerprotokoll und zu tun json.dumps drauf dann klappt es perfekt. Was soll ich machen?

+1

scheint wie Standard der Standard-Python 'json' Modul ist hier ein bisschen dumm. Ich habe es mit 'demjson' versucht und es funktioniert gut. Es scheint jedoch, dass es etwas mit verschachtelten Wörterbüchern zu tun hat. – Granitosaurus

+0

danke! mit Demjson arbeitete. – vigenere

Antwort

0

Wenn Sie möchten, dass Ihre Artikel als json ouput benutzen Sie einfach:

scrapy crawl spider -o output.json 
+0

Ich bekomme diesen Fehler nur während dies tun – vigenere

Verwandte Themen