-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KeyError self.editor_ids[self.current_editor] #15668
Comments
Is spyder/spyder/plugins/outlineexplorer/widgets.py Lines 330 to 344 in 0427e5b
spyder/spyder/plugins/outlineexplorer/widgets.py Lines 469 to 488 in 0427e5b
|
I inserted some print statements at line 412 and ran bootstrap from a pyenv environment with PyQt5=5.15.4 @Slot()
def go_to_cursor_position(self):
if self.current_editor is not None:
print(f'TEST: self.current_editor = {self.current_editor}')
print(f'TEST: self.editor_ids = {self.editor_ids}')
editor_id = self.editor_ids[self.current_editor] with the following results
That was upon startup. I was incorrect about my assumption that it was looking for a string object. It appears that the dictionary is using unique objects as keys.
Can you run with some print statements to see under what circumstances there is a KeyError? |
Same print statements as yours: console calling spyder:
Then switching projects, upon switching back there appears the "Issue reporter" with different contents for editor_ids:
The message in the debug window starts with the editor_ids print, but the current_editor print is missing! |
Oh, I need to have at least 2 files open in a split editor window in order to trigger the error! |
I had a minimum of two files opened in each project. Can you remind me of your system setup? Ubuntu, right? Can you also include your environment ( |
Sorry, openSUSE. I don't have a VM for that, so I can't test it. I can check on Ubuntu, though. |
I am not sure, but I think between startup and display of the issue reporter some capture of printout kicks in.
No conda or virtual environment at all, no pip install. Plain openSUSE packages. The versions are not 100% compliant with the Spyder pins, so I can completely understand when you are not willing to put too much effort into the investigation:
Addtionally relevant:
When I close the outline editor panel, there is no error and trigger of issue reporter. Even without switching projects, or the error, the contents of the outline explorer do not look right to me: |
Well, I would definitely recommend creating a virtual environment from which to run Spyder. You can still use any other Python environment (including your system environment) to work in (running the Console and executing code). See https://docs.spyder-ide.org/current/installation.html#new-conda-environment or https://docs.spyder-ide.org/current/installation.html#using-pip. |
I cannot reproduce the error anymore. None of the listed direct dependencies changed from #15668 (comment) to now. Notable changes which could be related:
That currently pulls in 538 MB of unnecessary, duplicate and outdated stuff. Most notably a complete set of precompiled Qt libraries, which don't work well in parallel with an already loaded system Qt. |
@bnavigator , it actually looks like your first error is
which means that
self.current_editor
returns anOutlineExplorerProxyEditor
object instead of a string object. Could this be related to PyQt5 >= 5.13?Originally posted by @mrclary in #14803 (comment)
The text was updated successfully, but these errors were encountered: