You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Spyder doesn't handle some nonexistent files properly when it tries to reopen files on startup. Usual nonExistingFiles are just not opened (fine) while certain files cause a crash.
The problematic path is unusual: It has a Directory Junction pointing to a Symlink whose target is on a network drive that is unavailable during the crash.
I noticed pythons open() on the file takes on the order of seconds until it raises, my guess is that the underlying syscall itself is taking so long.
My guess is that the problem is like a race condition in that it is usually caught. However I guess the location of the problem in spyder's code is so clear that it is possible to add more exception handling fixing the issue, even if the error cannot be reproduced.
The code that lacks some exception handling is most likely in spyder\plugins\editor\widgets\editor.py around line 1500 in set_current_filename() or a bit further down. See traceback.
local nonExistingFile: fine
nonExistingFile on a windows network drive: fine
(on local drive:) Directory Junction -> symlink to directory on unavailable network drive -> consequently nonExistingFile : raises.
The error was reproduced with a fresh ~/.spyder-py3 where in the config/transient.py the problematic filename was inserted.
What steps reproduce the problem?
put a problematic non-existent file into ~/spyder-py/config/transient.ini -> [editor] section -> filenames list.
open spyder. Spyder crashes
Paste Traceback/Error Below (if applicable)
C:\WINDOWS\system32>python -m spyder.app.start
No QCoreApplication instance found. Application patches not applied. You have to call load_stylesheet function after instantiation of QApplication to take effect.
Pruned plugin: outline_explorer
Missing requirement: completions
Restart plugins pruning by REQUIRES check
Traceback (most recent call last):
File "C:\Program Files\Python39\lib\ntpath.py", line 647, in realpath
path = _getfinalpathname(path)
FileNotFoundError: [WinError 53] The network path was not found: 'C:\\Links\\nonExisting.py'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Python39\lib\runpy.py", line 197, in _run_module_as_mainreturn _run_code(code, main_globals, None,
File "C:\Program Files\Python39\lib\runpy.py", line 87, in _run_codeexec(code, run_globals)
File "C:\Program Files\Python39\lib\site-packages\spyder\app\start.py", line 231, in <module>
main()
File "C:\Program Files\Python39\lib\site-packages\spyder\app\start.py", line 213, in main
mainwindow.main(options, args)
File "C:\Program Files\Python39\lib\site-packages\spyder\app\mainwindow.py", line 2310, in main
mainwindow = create_window(app, splash, options, args)
File "C:\Program Files\Python39\lib\site-packages\spyder\app\mainwindow.py", line 2171, in create_window
main.post_visible_setup()
File "C:\Program Files\Python39\lib\site-packages\spyder\app\mainwindow.py", line 1303, in post_visible_setupself.editor.setup_open_files(close_previous_files=False)
File "C:\Program Files\Python39\lib\site-packages\spyder\plugins\editor\plugin.py", line 3165, in setup_open_filesself.load(filenames[index::-1], goto=clines[index::-1],
File "C:\Program Files\Python39\lib\site-packages\spyder\plugins\editor\plugin.py", line 2190, in load
current_editor =self.set_current_filename(filename,
File "C:\Program Files\Python39\lib\site-packages\spyder\plugins\editor\plugin.py", line 1720, in set_current_filenamereturn editorstack.set_current_filename(filename, focus)
File "C:\Program Files\Python39\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 1507, in set_current_filename
index =self.has_filename(filename)
File "C:\Program Files\Python39\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 1501, in has_filenameif fixpath(filename) == fixpath(finfo.filename):
File "C:\Program Files\Python39\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 1499, in <lambda>
fixpath =lambdapath: osp.normcase(osp.realpath(path))
File "C:\Program Files\Python39\lib\ntpath.py", line 651, in realpath
path = _getfinalpathname_nonstrict(path)
File "C:\Program Files\Python39\lib\ntpath.py", line 601, in _getfinalpathname_nonstrict
path = _getfinalpathname(path)
FileNotFoundError: [WinError 53] The network path was not found: 'C:\\Links\\nonExisting.py'
Traceback (most recent call last):
File "C:\Program Files\Python39\lib\site-packages\spyder\widgets\dock.py", line 253, in install_tab_event_filter
tabbars =self.main.findChildren(QTabBar)
RuntimeError: wrapped C/C++ object of type MainWindow has been deleted
Traceback (most recent call last):
File "C:\Program Files\Python39\lib\site-packages\spyder\widgets\dock.py", line 253, in install_tab_event_filter
tabbars =self.main.findChildren(QTabBar)
RuntimeError: wrapped C/C++ object of type MainWindow has been deleted
Traceback (most recent call last):
File "C:\Program Files\Python39\lib\site-packages\spyder\widgets\dock.py", line 253, in install_tab_event_filter
tabbars =self.main.findChildren(QTabBar)
RuntimeError: wrapped C/C++ object of type MainWindow has been deleted
Traceback (most recent call last):
File "C:\Program Files\Python39\lib\site-packages\spyder\widgets\dock.py", line 253, in install_tab_event_filter
tabbars =self.main.findChildren(QTabBar)
RuntimeError: wrapped C/C++ object of type MainWindow has been deleted
Traceback (most recent call last):
File "C:\Program Files\Python39\lib\site-packages\spyder\widgets\dock.py", line 253, in install_tab_event_filter
tabbars =self.main.findChildren(QTabBar)
RuntimeError: wrapped C/C++ object of type MainWindow has been deleted
Traceback (most recent call last):
File "C:\Program Files\Python39\lib\site-packages\spyder\widgets\dock.py", line 253, in install_tab_event_filter
tabbars =self.main.findChildren(QTabBar)
RuntimeError: wrapped C/C++ object of type MainWindow has been deleted
Traceback (most recent call last):
File "C:\Program Files\Python39\lib\site-packages\spyder\widgets\dock.py", line 253, in install_tab_event_filter
tabbars =self.main.findChildren(QTabBar)
RuntimeError: wrapped C/C++ object of type MainWindow has been deleted
However I guess the location of the problem in spyder's code is so clear that it is possible to add more exception handling fixing the issue, even if the error cannot be reproduced.
I was thinking exactly the same. We'll add a try/except to avoid showing this error then and add it to our next version (5.0.4), to be released shortly.
ccordoba12
changed the title
spyder crashes due to uncaught FileNotFoundError on startup
Spyder crashes due to uncaught FileNotFoundError on startup
May 27, 2021
Problem Description
Spyder doesn't handle some nonexistent files properly when it tries to reopen files on startup. Usual nonExistingFiles are just not opened (fine) while certain files cause a crash.
The problematic path is unusual: It has a Directory Junction pointing to a Symlink whose target is on a network drive that is unavailable during the crash.
I noticed pythons
open()
on the file takes on the order of seconds until it raises, my guess is that the underlying syscall itself is taking so long.My guess is that the problem is like a race condition in that it is usually caught. However I guess the location of the problem in spyder's code is so clear that it is possible to add more exception handling fixing the issue, even if the error cannot be reproduced.
The code that lacks some exception handling is most likely in spyder\plugins\editor\widgets\editor.py around line 1500 in set_current_filename() or a bit further down. See traceback.
The error was reproduced with a fresh ~/.spyder-py3 where in the config/transient.py the problematic filename was inserted.
What steps reproduce the problem?
~/spyder-py/config/transient.ini
-> [editor] section -> filenames list.Paste Traceback/Error Below (if applicable)
Versions
Dependencies
The text was updated successfully, but these errors were encountered: