conda update spyder (or pip, if not using Anaconda)jupyter qtconsole (if console-related)spyder --resetI keep getting this error message when trying to restore files. Spyder is open in drive D and backup file is in drive C.

The error states that the system cannot move the file between different drives. Therefore, I just discard the auto-saved file, to let Spyder launches.
PASTE TRACEBACK HERE
PASTE DEPENDENCIES HERE
pygments >=2.0 : 2.3.1 (OK)
qdarkstyle >=2.6.4: 2.6.5 (OK)
sphinx >=0.6.6 : 1.8.3 (OK)
pyls >=0.19.0 : 0.19.0 (OK)
nbconvert >=4.0 : 5.4.0 (OK)
pandas >=0.13.1 : 0.23.4 (OK)
numpy >=1.7 : 1.15.4 (OK)
sympy >=0.7.3 : 1.3 (OK)
cython >=0.21 : 0.29.3 (OK)
qtconsole >=4.2.0 : 4.4.3 (OK)
IPython >=4.0 : 7.2.0 (OK)
matplotlib >=2.0.0: 3.0.2 (OK)
pylint >=0.25 : 2.2.2 (OK)
This might give an idea to the solution.
https://bugs.python.org/issue29805
@jitseniesen, could you take a look at this one? Thanks!
@Khalilsqu Thanks for the report. I think the solution is to change line 224 of recover.py from
except AttributeError:
to
except (AttributeError, OSError):
However, I don't have access to a Windows machine at the moment to test this. Can you please check whether this helps? Thanks.
Indeed it works, with your suggestion and the file is restored correctly.
But this change is necessary too
if PY2:
import shutil
to
import shutil
otherwise a NameError is raised on py3
Thanks for checking.
I think probably shutil.move(autosave['name'], orig_name)
might replace all of
try:
os.replace(autosave['name'], orig_name)
except AttributeError: # Python 2
shutil.copy2(autosave['name'], orig_name)
os.remove(autosave['name'])
but maybe I am wrong!
shutil.move exists in both py2 and py3. and if the source and destination are in different file-system(disk drives), it will use first shutil.copy2 and then remove the file from source folder.
I also have another question, it is necessary to show the recovery (restore) dialog when the user decides not to save modified files when closing Spyder?
As I understand the documentation, shutil.move(src, dest) fails on Windows if dest already exists. Unfortunately.
I also have another question, it is necessary to show the recovery (restore) dialog when the user decides not to save modified files when closing Spyder?
It shouldn't. I think @CAM-Gerlach also mentioned this on Gitter. I'll have a look later today.
Thanks, indeed you are right,