Add a command-line option for overwriting exported file
See original GitHub issueWhat do you think about adding an option to overwrite/recreate exported file? Something like
$ scrapy crawl myspider -o data.jl --overwrite
or
$ scrapy crawl myspider -O data.jl
This is useful during development where old data is not needed. I usually run
$ rm data.jl; scrapy crawl myspider -o data.jl
multiple times. This is not DRY: if I want to change file name for the next iteration and preserve existing file then I must be careful and update both names (of course, the command comes from shell autocompletion).
Issue Analytics
- State:
- Created 10 years ago
- Reactions:10
- Comments:17 (9 by maintainers)
Top Results From Across the Web
Write to file, but overwrite it if it exists - Stack Overflow
The >> redirection operator will append lines to the end of the specified file, where-as the single greater than > will empty and...
Read more >Overriding (GNU make)
When you override a variable with a command line argument, you can define either a recursively-expanded variable or a simply-expanded variable. The examples ......
Read more >DISM Image Management Command-Line Options
/Export-Image. Exports a copy of the specified image to another file. The source and destination files must use the same compression type. You ......
Read more >NK2Edit Command Line Options (Edit Outlook AutoComplete ...
... store of Exchange Server 2010 may overwrite the changes you made with NK2Edit. This command-line option allows you to export the AutoComplete...
Read more >Add to keys from the command line and not overwrite
From my testing it appears that the command line option passed to sonar-scanner is the only one used. The option in the properties...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If we have
-o
and-O
then how can you tell which one is default? Both must be written explicitly.But @darkrho raised an interesting question because
-o
doesn’t play well with csv, xml and pickle currently: csv adds an extra header, xml starts a new xml instead of adding to previous, and pickle does the same.As a side note:
scrapy crawl myspider -o combined.jl -O last.jl
can also be useful, and users will try writing this.In the meantime one could subclass
FileFeedStorage
. I just typed an answer over at http://stackoverflow.com/a/40823149/2546958 before I spotted this issue.