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: add missing import io in iomenu.py #85472
Comments
idle cannot save file with non ascii character, leading to: Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib64/python3.8/tkinter/__init__.py", line 1883, in __call__
return self.func(*args)
File "/usr/lib64/python3.8/idlelib/multicall.py", line 176, in handler
r = l[i](event)
File "/usr/lib64/python3.8/idlelib/iomenu.py", line 199, in save
else:
File "/usr/lib64/python3.8/idlelib/iomenu.py", line 232, in writefile
text = self.fixnewlines()
File "/usr/lib64/python3.8/idlelib/iomenu.py", line 271, in encode
encoded = chars.encode('ascii', 'replace')
NameError: name 'io' is not defined just adding |
Your suggestion is correct. A side issue is that the line numbers in the traceback are correct but the quoted text lines from iomenu (and only iomenu) are wrong, being from the line previous. I will have to investigate this discrepancy. After the patch, two weeks ago, for bpo-41158, iomenu line 199 in save is Before I close this, I will try to add a unittest that similarly fails without the import added, as well as some others for other exit points. |
Łukasz, please pull this simple fix to a 3.9.0b4 and 3.8.4 regression into 3.8.5. It disabled saving files with non-ascii chars. |
Łukasz, Please cherry-pick the 3.8 backport, ffeb920, as it has a 3.8-specific fixup to idlelib/NEWS.txt. I verified the bug and fix on Windows. I am leaving this open to add automated tests. |
Problem also reported on bpo-41319 |
bpo-41319 should be closed as a duplicate, but site will not currently allow me to do so. |
Released. |
The fix is in both 3.8.5 and 3.9.0b5, both released today. Łukasz, thanks for getting this in. I am leaving this open to add tests, but will remove you as nosy. |
bpo-41373 is about another issue with the new iomenu code. I will close this and add tests there. |
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: