Spyder: Script empty after Spyder crash

Created on 2 Mar 2018  路  20Comments  路  Source: spyder-ide/spyder

Problem Description

When running my script Spyder (Python 3.5) crashed. When restarting Spyder the script was empty. I had been working on this script for a few days and had saved it several times in between, however, I didn't rename the updated versions of the script so essentially I just lost a few days of work. The same thing happened to me a few weeks ago with another script but back then I had another version of the script on a different machine so I could just copy it over and it was all good. This time unfortunately I don't have another version of my script. I'm using Anaconda.

Has anyone else had an experience like this?
Is there any way of recovering my script (some hidden temporary file or so)?
Any idea why the script gets deleted?

What steps will reproduce the problem?

I'm not sure how to reproduce this problem but it's the second time this happened, each time with different scripts.

Package Versions

  • Spyder: 3.2.7
  • Python: 3.5.4 64 bits
  • Qt: 5.6.2
  • PyQt: 5.6
  • Operating System: Windows 10

Dependencies

IPython >=4.0 : 6.1.0 (OK)
cython >=0.21 : 0.26.1 (OK)
jedi >=0.9.0 : 0.10.2 (OK)
nbconvert >=4.0 : 5.3.1 (OK)
numpy >=1.7 : 1.13.3 (OK)
pandas >=0.13.1 : 0.21.0 (OK)
pycodestyle >=2.3: 2.3.1 (OK)
pyflakes >=0.6.0 : 1.6.0 (OK)
pygments >=2.0 : 2.2.0 (OK)
pylint >=0.25 : 1.7.4 (OK)
qtconsole >=4.2.0: 4.3.1 (OK)
rope >=0.9.4 : 0.10.5 (OK)
sphinx >=0.6.6 : 1.6.3 (OK)
sympy >=0.7.3 : 1.1.1 (OK)

Duplicate

Most helpful comment

You can get it from history log if you had executed the code

All 20 comments

We're really sorry to hear this. I don't understand how Spyder can delete your script, but we're working to provide autosaving functionality for our next major release (Spyder 4).

If you manage to get a way to reproduce this, please post it here.

Really sorry to hear that. You weren't using a script named test.py or temp.py by any chance, were you? Did you double check your script at its original location in another application? Anything informative wrt to the last modification date or any other file properties?

Even if you didn't have any backups that would allow you to recover it, you may be able to get it back from the automatic Windows File History feature if its turned on. Go to the file, under properties, and look for "Previous Versions" and hopefully windows saved one.

Also, while version control systems like git are not intended to primarily be backup systems, they certainly can be used as one and would prevent any such situation like this in the future (at most, you might loose any work since your last commit, which shouldn't be too big of an issue if you commit early and often as is recommended). There are also a lot of other benefits as well; I used to think git wasn't worth it just for scripts and data analysis stuff but once I started using it, I can't tell you how many dozens of times its saved my bacon and helped out in so many ways, so I strongly recommend one.

Again, sorry, and best of luck!

Also, see #6567 for a detailed report of a similar-sounding issue that it turned out the script was saved after all.

Closed due to lack of response and duplication with other issues.

I just had this issue, though I wouldn't know how to reproduce it on demand. My computer froze while editing a script, and the script ended up as a blank file. Kicking myself for not using git.
Spyder 3.3.3

@bayesfactor Really sorry about this; it should be fixed in Spyder 4 but the final version isn't out yet. Perhaps you have a backup somewhere, or you have file history (Windows) or Time Machine (Mac) turned on?

I had this issue too! :( When spyder 4 will be released? it has been 2 years that im told it will be in spyder 4...

I had the same issue too. Entire day of work lost. So frustrating. :(

@isalirezag @ananya11 Really sorry to hear that. Hopefully you were able to recover your files from git or a backup.

However, the good news is this should be resolved in Spyder 4; we've implemented much more robust handling of saving files, as well as an autosave and recovery feature that will allow you to restore your work in case Spyder does crash or something else goes wrong. Beta 2 with it implemented should be released in a few days, so look out for that if you want to test out the latest Spyder has to offer.

You can get it from history log if you had executed the code

@NeerajSahani This issue is resolved in Spyder 4, which was released over month ago (4.0.1 was out as of a couple days ago) via a triple layer of protection:

First, I _believe_ we actually found and fixed at least one of the original issues that triggered this, Spyder trying to save a file when the user was out of disk space. Second, files are always saved robustly and atomically to disk, such that if anything (such as the previous error) were to go wrong with the save process, the save would not overwrite the existing file. Third, Spyder 4 has a new autosave system that continually saves a backup copy of your unsaved file to disk, so if Spyder crashes, hangs or closes unexpectadly or there is an error with saving you'll still have a copy of the latest changes from the last <60 s.

Ergo, the real solution is to upgrade to Spyder 4, which is why the issue this issue duplicates was marked closed and resolved. Thanks.

Hi, I just had the similar issue with file going missing following a crash. The solution has been suggested as updating to Spyder 4. However, upon updating it through Anaconda, Spyder became unusable. Reverting back to a 3. version allowed me to continue working with Spyder though.

However, I'd still like to update to Spyder 4 -- any suggestions would be welcome. Thanks

However, upon updating it through Anaconda, Spyder became unusable.

Sorry you're having issues. In order for anyone to be able to provide you more specific help than that found in the Spyder Troubleshooting Guide, we'll need to know much more specifically what the actual problem(s) are that you are experiencing. Did Spyder crash or hang? Was there a specific bug? Was the UX bad? Was it simply too slow? Please search through the issues on our repo for keywords that specifically describe your problem(s), and if there aren't any, open a new issue describing in as much detail as possible what is going on, including filling out the template provided (Spyder can do that for you, either from an error report or by choosing the "Report Issue" option in the help menu). Thanks, and best of luck.

Hello, my script just complete erased with no warning after error. I am running Spyder 4.1.2. The program is set to autosave so it usually saves at execution. Not that it has anything do with that happened, but I had just written a for loop command to iterate through a list and wrote,
for i in rang(1,4,1)
x = 2*i
and it immediately caught the error, but as soon as it had caught it, the iPython kernal restarted and it just erase my entire script. It did not seem to fully exit spyder, it froze momentarily, and erased everything. It completely overwrote the existing file. Is there any solution to recuperate the script?

You can get it from history log if you had executed the code

Were is the history log, I can not find it.

@ccordoba12 @jitseniesen This seems pretty serious if its still possible and not caught by autosave...might be worth taking a closer look at?

@ccordoba12 @jitseniesen This seems pretty serious if its still possible and not caught by autosave...might be worth taking a closer look

Hello, it just happened again a few hours ago. With almost the exact same syntax error with a for loop. I for sure need to learn to type. I have been writing scripts to mass print plots to pdfs, and save pngs, audio files to a new directories under these for loops. It seems that after running these scripts and saving makes the IPython buggy, catching errors that will go away after restarting Spyder. I have the setting to erase all variables at execution so there shouldn't be issues from previous variables that wouldnt be there after restarting Spyder.

@DCALDE1, please open a new issue about your problem with clear, step-by-step way to reproduce it. Thanks!

spyder4 suddenly shows 0 tweets...screenshot is attached..pls help
Capture4

@jassena Sorry, but I'm not sure how your own code having some sort of problem accessing the Twitter API has something to do with an issue about Spyder deleting the contents of a user's script. Unless the same code works if you run it in a normal Python console (e.g. python untitled1.py) but not in Spyder at the same time, the issue is presumably isn't connected with Spyder, and I would suggest you check the documentation for twitterscraper or the Twitter API to figure out what's going on.

I've never used that package, but if I were to guess, you're probably either running out of results to return, or have hit some API limit. Best of luck fixing it!

Was this page helpful?
0 / 5 - 0 ratings