question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add a command-line option for overwriting exported file

See original GitHub issue

What 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:closed
  • Created 10 years ago
  • Reactions:10
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
kmikecommented, Jan 20, 2014

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.

1reaction
robkorvcommented, Nov 26, 2016

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found