spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.33k stars 1.61k forks source link

FileNotFoundError on Revert untitled file #14692

Open aPischel opened 3 years ago

aPischel commented 3 years ago

Description

What steps will reproduce the problem?

tried to revert unsaved file 'untitled.py' as my computer crashed overnight and i lost a large file that i of course did not save.

Traceback

  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\editor\plugin.py", line 2161, in revert
    editorstack.revert()
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2606, in revert
    self.reload(index)
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2572, in reload
    txt, finfo.encoding = encoding.read(finfo.filename)
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\encoding.py", line 306, in read
    text, encoding = decode( open(filename, 'rb').read() )
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\AdamPischel\\OneDrive - MGB\\Python\\REST API\\untitled0.py'

Versions

Dependencies


# Mandatory:
atomicwrites >=1.2.0            :  1.4.0 (OK)
chardet >=2.0.0                 :  4.0.0 (OK)
cloudpickle >=0.5.0             :  1.6.0 (OK)
diff_match_patch >=20181111     :  20200713 (OK)
intervaltree >=3.0.2            :  3.1.0 (OK)
IPython >=4.0                   :  7.19.0 (OK)
jedi =0.17.2                    :  0.17.2 (OK)
jsonschema >=3.2.0              :  3.2.0 (OK)
nbconvert >=4.0                 :  6.0.7 (OK)
numpydoc >=0.6.0                :  1.1.0 (OK)
paramiko >=2.4.0                :  2.7.2 (OK)
parso =0.7.0                    :  0.7.0 (OK)
pexpect >=4.4.0                 :  4.8.0 (OK)
pickleshare >=0.4               :  0.7.5 (OK)
psutil >=5.3                    :  5.7.2 (OK)
pygments >=2.0                  :  2.7.4 (OK)
pylint >=1.0                    :  2.6.0 (OK)
pyls >=0.36.1;<1.0.0            :  0.36.2 (OK)
pyls_black >=0.4.6              :  0.4.6 (OK)
pyls_spyder >=0.1.1             :  0.3.0 (OK)
qdarkstyle >=2.8                :  2.8.1 (OK)
qtawesome >=0.5.7               :  1.0.1 (OK)
qtconsole >=4.7.7               :  4.7.7 (OK)
qtpy >=1.5.0                    :  1.9.0 (OK)
rtree >=0.8.3                   :  0.9.4 (OK)
setuptools >=39.0.0             :  51.3.3.post20210118 (OK)
sphinx >=0.6.6                  :  3.4.3 (OK)
spyder_kernels >=1.10.0;<1.11.0 :  1.10.1 (OK)
three_merge >=0.1.1             :  0.1.1 (OK)
watchdog >=0.10.3               :  0.10.4 (OK)
zmq >=17                        :  20.0.0 (OK)

# Optional:
cython >=0.21                   :  0.29.21 (OK)
matplotlib >=2.0.0              :  3.3.2 (OK)
numpy >=1.7                     :  1.19.2 (OK)
pandas >=1.1.1                  :  1.2.1 (OK)
scipy >=0.17.0                  :  1.5.2 (OK)
sympy >=0.7.3                   :  1.7.1 (OK)
ccordoba12 commented 3 years ago

Hey @aPischel, thanks for reporting. You said:

tried to revert unsaved file 'untitled.py'

What do you exactly mean by this?

aPischel commented 3 years ago

So, my computer crashed overnight and after re-starting spyder, I opened a new tab, didn’t save anything and then selected ‘Revert’ as shown below. This is what caused the error.

Thanks!

Adam

From: Carlos Cordoba notifications@github.com Sent: Thursday, February 4, 2021 12:41 PM To: spyder-ide/spyder spyder@noreply.github.com Cc: Adam adamjpischel@gmail.com; Mention mention@noreply.github.com Subject: Re: [spyder-ide/spyder] Error on Revert (#14692)

Hey @aPischel https://github.com/aPischel , thanks for reporting. You said:

tried to revert unsaved file 'untitled.py'

What do you exactly mean by this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/spyder-ide/spyder/issues/14692#issuecomment-773485872 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AIG5ZPQJVGX3FTFN5UCQ55TS5LL25ANCNFSM4XCZ4OAA . https://github.com/notifications/beacon/AIG5ZPQQ4MJ6Y7QZGKNHTW3S5LL25A5CNFSM4XCZ4OAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFYNHKMA.gif

ccordoba12 commented 3 years ago

Could you upload your image by dragging and dropping it directly here? Unfortunately, Github doesn't allow to send images through email.

aPischel commented 3 years ago

Revert

ccordoba12 commented 3 years ago

Thanks @aPischel, now I understand what's happening. We'll try to fix this error in a future release.

aPischel commented 3 years ago

Great! Glad to help