diff --git a/francedata/pipelines.py b/francedata/pipelines.py index fcf1f91484f9c910dbc644dd71821ef2f847bf29..c497e5a4d5eb7d3a62ba75b0af742ae8f6d97319 100644 --- a/francedata/pipelines.py +++ b/francedata/pipelines.py @@ -28,7 +28,7 @@ class FrancedataPipeline(object): self.json = gzip.open(outfile, 'wb') def spider_opened(self, spider): - self.json.write('[') + self.json.write('['.encode()) try: spider.set_pipeline(self) @@ -43,7 +43,7 @@ class FrancedataPipeline(object): self.urls.add(item['url']) if self.has_items: - self.json.write(',\n') + self.json.write(',\n'.encode()) json.dump(item, self.json, cls=ScrapyJSONEncoder) self.has_items = True @@ -51,5 +51,5 @@ class FrancedataPipeline(object): return item def spider_closed(self, spider): - self.json.write(']') + self.json.write(']'.encode()) self.json.close()