hooliooo hooliooo - 6 months ago 34
Python Question

Scrapy overwrite json files instead of appending the file

Is there a way to overwrite the said file instead of appending it?

Example)

scrapy crawl myspider -o "/path/to/json/my.json" -t json
scrapy crawl myspider -o "/path/to/json/my.json" -t json


Will append the my.json file instead of overwrite it.

Answer
scrapy crawl myspider -t json --nolog -o - > "/path/to/json/my.json"