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
IDLE: Traceback on Find Selection #79772
Comments
This probably isn't a traceback that's likely to happen, but I wanted to document it since I was able to recreate it. To recreate: Exception in Tkinter callback
Traceback (most recent call last):
File "N:\projects\cpython\lib\tkinter\__init__.py", line 1883, in __call__
return self.func(*args)
File "N:\projects\cpython\lib\idlelib\editor.py", line 644, in find_selection_event
search.find_selection(self.text)
File "N:\projects\cpython\lib\idlelib\search.py", line 25, in find_selection
return _setup(text).find_selection(text)
File "N:\projects\cpython\lib\idlelib\search.py", line 72, in find_selection
return self.find_again(text)
File "N:\projects\cpython\lib\idlelib\search.py", line 65, in find_again
self.bell()
AttributeError: 'SearchDialog' object has no attribute 'bell' |
Thanks for reporting this. It is easy to trigger. And after a bit of analysis, easy to fix. self.bell is set as top.bell in searchbase.SearchDialogBase.create_widgets(). The latter is called by SDB.open(), which is called for Find, Find-again if there is no previously defined pattern, and Find-in-files. It is not called by Find-selection as it uses the selection as the pattern. The bell only sounds if the selection is not found anywhere else in the editor. The purpose of creating and calling self.bell instead of top.bell is so bell can be mocked when testing, both to detect the call and suppress noise when testing. Binding self.bell to root.bell in __init__ instead of to top.bell in create_widgets should work fine. |
I expect that people have run into this. But since callback exceptions do not crash IDLE, the only symptom when not running from a terminal is the lack of the 'bell' sound. |
Thanks for looking at this one. :-) |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: