sanchit goel
sanchit goel

Reputation: 51

How to recover unsaved file in spyder

Spyder crashed at the last minute and I had force quit the programme as it wasn't responding at all. After reopening it, I am not able to find my file that I was working on, i hadn't saved it and had quite a bit of code written in it. It will be a huge help if someone knows a way to recover it, and can guide me through it.

Upvotes: 5

Views: 44051

Answers (5)

val.ery
val.ery

Reputation: 49

I found the following solution:

  1. open a new terminal
  2. cd /home/pc/.config/spyder-py3/
  3. code .
  4. open the history.py file

Anyway, you will no longer find the file you discarded in the autosave folder, however, in the history.py file are saved the last 1000 lines that you executed, in my case the last 30 were enough.

Upvotes: 4

Palash Jhamb
Palash Jhamb

Reputation: 625

Go to C:\path.spyder-py3

You will have directories with the name autosave, you can find your autosaved files here. These are same ones that come up when you close and open spyder. It loads it from this autosave dir.

Another method is to check the history.py file which stores commands run in spyder console. However, there is a limit to this history. The old ones will get deleted.

Upvotes: 3

user215865
user215865

Reputation: 512

hist -g will show console history logs. You can recover your code from history if you had run your code earlier.

Upvotes: 18

Vishal singh rajpoot
Vishal singh rajpoot

Reputation: 123

Just for the people who still want to know the solution, close and open again Spyder application. It will ask you to recover the file. This worked for me today.

Upvotes: 1

KittenCrypto
KittenCrypto

Reputation: 121

I experienced a similar situation where I had added code to existing script that later wasn't saved as I expected it to be. I was able to recover my code from the history log (copy and paste). Not a perfect solution, but much better than having to re-write the code.

I am on Spyder 3.3.4

Upvotes: 8

Related Questions