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
IDLE crashes if the user scrolls with the Mac mousepad (using two fingers, either up or down).
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/idlelib/__main__.py", line 7, in <module>
idlelib.pyshell.main()
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/idlelib/pyshell.py", line 1572, in main
root.mainloop()
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 1283, in mainloop
self.tk.mainloop(n)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
FWIW, I can't reproduce the failure using either Python 3.7.3 from either the python.org binary installer or a current MacPorts 3.7.3. But that's not surprising as the issue is most likely in Tk rather than IDLE or Python itself. Can you supply the output from the following commands in a terminal session, assuming python3 is the same interpreter used to run IDLE?
For future reference: an exception is not a crash. A crash is a core dump or the Mac equivalent.
Anyway, I also cannot reproduce with Python.org python on my Macbook.
python 3.7.3(v3.7.3:ef4e...) Mar 25, 2019 16:52:21
Clang 6.0 (...) on Darwin
Where did you get your Python installer? Did it include tck/tk? If not, perhaps python3.exe and the tcl/tk being used do not match.
Does IDLE work at all? Can you click Help and About IDLE? If so, what is the tk version?
I used the pad to move the cursor over the scrollbar slider, held my left finger down on the left side of the pad, and moved the slider and file display with my right finger. Is this what you did?
From the traceback it appears that the exception occurred in the C code of _tkinter or more likely, the C code of tcl/tk, before any of IDLE's python-coded event handlers are called. Hence, Ned's comment.
What language and encoding are you using on your system? Are you using UTF-16?
I haven't been able to reproduce this on my Mac Mojave with an Anaconda Python 3.7.3 install.
RakeshSingh commented on Jun 25, 2019
RakeshSinghmannequin
Mannequin
More actions
Same behaviour experienced here on Mojave Kernel Version 18.6.0.
Homebrew Python 3.7.3
Python 3.7.3 (default, Jun 19 2019, 07:38:49)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license()" for more information.
WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable. Visit http://www.python.org/download/mac/tcltk/ for current information.
>>
It seems to be compiled using Tcl 8.5 that is installed with the system.
IDLE shipped with Anaconda works correctly.
It seems to be compiled using Tcl 8.5 that is installed with the system.
Yes, and that is almost certainly the original poster's problem, as well. In fact, this same issue was reported in bpo-10731 in 2010. The Tcl/Tk 8.5 supplied by Apple in macOS is terribly out-of-date and dangerously buggy; it should never be used. You should even be seeing a warning message from IDLE when using that system Tcl/Tk. I'm not familiar with how Homebrew manages the Tcl/Tk that their Pythons link with but, if necessary, you should follow up with them to ensure that none of their recipes use the system Tcl/Tk.
@ terry.reedy, sorry to mislabel as a crash. IDLE itself just sorta died, so I interpreted it as an IDLE crash even though it's just an exception in the actual Python interpreter. Oops!
Addressing your questions here:
Where did you get your Python installer? Did it include tck/tk? If not, perhaps python3.exe and the tcl/tk being used do not match.
Got the python installer via Homebrew.
It appears to include tck/tk. Not 100% sure but I'm guessing based on this line in the traceback that the python installation has TK File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py",
Here is the brew info:
➜ ~ brew info python
python: stable 3.7.3 (bottled), HEAD
Interpreted, interactive, object-oriented programming language
https://www.python.org/
/usr/local/Cellar/python/3.7.3 (4,094 files, 62.5MB) *
Poured from bottle on 2019-04-19 at 14:02:45
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/python.rb
==> Dependencies
Build: pkg-config ✔
Required: gdbm ✔, openssl ✔, readline ✔, sqlite ✔, xz ✔
==> Options
--HEAD
Install HEAD version
==> Caveats
Python has been installed as
/usr/local/bin/python3
Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/usr/local/opt/python/libexec/bin
If you need Homebrew's Python 2.7 run
brew install python@2
You can install Python packages with
pip3 install <package>
They will install into the site-package directory
/usr/local/lib/python3.7/site-packages
See: https://docs.brew.sh/Homebrew-and-Python
==> Analytics
install: 347,669 (30 days), 1,285,928 (90 days), 4,302,103 (365 days)
install_on_request: 166,131 (30 days), 625,120 (90 days), 2,423,737 (365 days)
build_error: 0 (30 days)
Does IDLE work at all? Can you click Help and About IDLE? If so, what is the tk version?
IDLE works otherwise, yes. It's just the scrolling bug that's causing any issue.
Python Version: 3.7.3
Tk version: 8.5.9
IDLE version: 3.7.3
I used the pad to move the cursor over the scrollbar slider, held my left finger down on the left side of the pad, and moved the slider and file display with my right finger. Is this what you did?
I can break down the steps to reproduce on a more physical level
To really break down the steps to reproduce on a physical level:
STEPS TO REPRODUCE:
Open the IDLE application
These steps work regardless of opening Idle 3.app via the finder GUI, or by running python -m idlelib
Before scrolling, do either of the following so IDLE receives the scroll
Focus on the IDLE application so it's the foreground app (you can do this by clicking on the IDLE app window). The cursor can be over the IDLE app, or outside of it. It doesn't matter since the app is focused.
OR, focus on a different application (IDLE is not foreground anymore) but have IDLE be visible still. Hover the cursor over IDLE. Take care not to click, which would bring IDLE back to the foreground.
Scroll. To scroll, do either of the following:
Scroll using the scrollwheel on a conventional external mouse.
Scroll using the touchpad on the Mac. Using two fingers, set them on the touchpad and slide both fingers vertically. A picture is worth a thousand words, so here is a video showing the motion: https://www.youtube.com/watch?v=GV9GDPsO730
The IDLE app will "crash" (close). If run from the command line, the UnicodeDecodeError exception will be shown.
And now finally, back to @rakesh Singh and @ned.deily,
As given in the otool output above, TK is given as /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk (compatibility version 8.5.0, current version 8.5.9)
so what you're saying certainly makes sense.
I can try uninstalling and resintalling python with homebrew and if the problem persists, then is the issue on their end and their reliance on the default Apple TK?
I imagine then the bug would be on their plate.
GeorgePantazes commented on Jun 25, 2019
GeorgePantazesmannequin
MannequinAuthor
More actions
Checked against the python.org installation. In that installation's IDLE, About IDLE > Tk version 8.6.8.
So my question is:
Is it on me to fix this for my own machine because I should have gotten my own more-up-to-date TK before installing Python via Homebrew?
Or is this a Homebrew installation bug? And should they include a more up-to-dat TK with their installation?
You may wish to try the suggestions found there. My recommendation would be to use the official Python from python.org or the Anaconda distribution for Mac.
As @willingc notes, it is a Homebrew build issue that should be addressed by Homebrew. That said, it is also possible that Homebrew builds have been affected by changes in Mojave as mentioned in bpo-34956. I plan to look into that shortly to see if we can make building with a third-party Tk easier on macOS.
GeorgePantazes commented on Jun 25, 2019
GeorgePantazesmannequin
MannequinAuthor
More actions
In case anyone would like to weigh in on the Homebrew side, I've filed the homebrew issue here: Homebrew/homebrew-core#41338 .
It seems that the current warning
WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable. Visit http://www.python.org/download/mac/tcltk/ for current information.
is not visible or strong enough to prevent spurious issues like this.
I would like to either 1. make it much more visible -- all caps or whatever -- stronger -- "is buggy, will eventually fail" -- and explicitly request "don't report problems if you continue"; or 2. require 8.5.15 or even 8.6.x and refuse to continue and exit.
Does IDLE every run long enough with Apple's tk before failure to make continuing useful?
Does IDLE every run long enough with Apple's tk before failure to make continuing useful?
Yes, depending on what you are doing, IDLE *may* run just fine with the system Tk. But you may may run into this issue depending on how you scroll. Or, among the worst bugs, if you try to type in characters not directly available on the keyboard by using one of the available composition characters, like opt-u followed by a vowel to produced an "umlauted" vowel with the US keyboard layout, Tk will immediately crash taking IDLE with it and with no opportunity to save any work in progress. Many people will not run into those bugs but it can be very painful to those who do.
Any comments here before I open a new issue?
I don't think changing the message is going to make much of a difference. There isn't much an end user can do other to avoid the known behaviors that cause problems, install another version of Python (which may not be an option for many novice users), or not use IDLE. Back when we did not ship our own copy of Tcl/Tk with the python.org macOS installers, there *was* something else you might be able to do: install a more up-to-date third-party Tcl/Tk that would then be automatically used. But that's not longer an option nor is it needed.
I think the best thing we can do is help make it easier for people building Python to not link with the broken system Python and improve the using Python on macOS documentation. I have issues opened for both of those.
Activity
GeorgePantazes commentedon Jun 24, 2019
IDLE crashes if the user scrolls with the Mac mousepad (using two fingers, either up or down).
System Info: MacOS Mojave 10.14.5 (18F132)
Python:
3.7.3 (default, Mar 27 2019, 09:23:15)
[Clang 10.0.1 (clang-1001.0.46.3)]
sys.version_info(major=3, minor=7, micro=3, releaselevel='final', serial=0)
GeorgePantazes commentedon Jun 24, 2019
Also happens when I plug in a conventional mouse and use the mouse scrollwheel (so it's not just the touchpad scrolling!).
ned-deily commentedon Jun 25, 2019
FWIW, I can't reproduce the failure using either Python 3.7.3 from either the python.org binary installer or a current MacPorts 3.7.3. But that's not surprising as the issue is most likely in Tk rather than IDLE or Python itself. Can you supply the output from the following commands in a terminal session, assuming python3 is the same interpreter used to run IDLE?
python3 -m test.pythoninfo
otool -L $(python3 -c 'import _tkinter;print(tkinter.__file_)')
terryjreedy commentedon Jun 25, 2019
For future reference: an exception is not a crash. A crash is a core dump or the Mac equivalent.
Anyway, I also cannot reproduce with Python.org python on my Macbook.
python 3.7.3(v3.7.3:ef4e...) Mar 25, 2019 16:52:21
Clang 6.0 (...) on Darwin
Where did you get your Python installer? Did it include tck/tk? If not, perhaps python3.exe and the tcl/tk being used do not match.
Does IDLE work at all? Can you click Help and About IDLE? If so, what is the tk version?
I used the pad to move the cursor over the scrollbar slider, held my left finger down on the left side of the pad, and moved the slider and file display with my right finger. Is this what you did?
From the traceback it appears that the exception occurred in the C code of _tkinter or more likely, the C code of tcl/tk, before any of IDLE's python-coded event handlers are called. Hence, Ned's comment.
willingc commentedon Jun 25, 2019
Hi George,
What language and encoding are you using on your system? Are you using UTF-16?
I haven't been able to reproduce this on my Mac Mojave with an Anaconda Python 3.7.3 install.
RakeshSingh commentedon Jun 25, 2019
Same behaviour experienced here on Mojave Kernel Version 18.6.0.
Homebrew Python 3.7.3
Python 3.7.3 (default, Jun 19 2019, 07:38:49)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license()" for more information.
WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable. Visit
http://www.python.org/download/mac/tcltk/ for current information.
It seems to be compiled using Tcl 8.5 that is installed with the system.
IDLE shipped with Anaconda works correctly.
ned-deily commentedon Jun 25, 2019
Yes, and that is almost certainly the original poster's problem, as well. In fact, this same issue was reported in bpo-10731 in 2010. The Tcl/Tk 8.5 supplied by Apple in macOS is terribly out-of-date and dangerously buggy; it should never be used. You should even be seeing a warning message from IDLE when using that system Tcl/Tk. I'm not familiar with how Homebrew manages the Tcl/Tk that their Pythons link with but, if necessary, you should follow up with them to ensure that none of their recipes use the system Tcl/Tk.
More details here:
https://www.python.org/download/mac/tcltk/
willingc commentedon Jun 25, 2019
Thanks for the additional information Rakesh.
GeorgePantazes commentedon Jun 25, 2019
Alright folks, sorry there's going to be a lot of pasted blocks of output, so just look for where I @ your name to address your questions.
@ned.deily, here is the output of those info commands.
@ terry.reedy, sorry to mislabel as a crash. IDLE itself just sorta died, so I interpreted it as an IDLE crash even though it's just an exception in the actual Python interpreter. Oops!
Addressing your questions here:
STEPS TO REPRODUCE:
python -m idlelib@willingc
And now finally, back to @rakesh Singh and @ned.deily,
As given in the otool output above, TK is given as
/System/Library/Frameworks/Tk.framework/Versions/8.5/Tk (compatibility version 8.5.0, current version 8.5.9)so what you're saying certainly makes sense.
I can try uninstalling and resintalling python with homebrew and if the problem persists, then is the issue on their end and their reliance on the default Apple TK?
I imagine then the bug would be on their plate.
GeorgePantazes commentedon Jun 25, 2019
Checked against the python.org installation. In that installation's IDLE, About IDLE > Tk version 8.6.8.
So my question is:
willingc commentedon Jun 25, 2019
George,
This is a Homebrew build issue (see additional notes on the Brew forum https://discourse.brew.sh/t/cannot-get-python-to-use-tcl-tk-version-8-6/3563.
You may wish to try the suggestions found there. My recommendation would be to use the official Python from python.org or the Anaconda distribution for Mac.
ned-deily commentedon Jun 25, 2019
As @willingc notes, it is a Homebrew build issue that should be addressed by Homebrew. That said, it is also possible that Homebrew builds have been affected by changes in Mojave as mentioned in bpo-34956. I plan to look into that shortly to see if we can make building with a third-party Tk easier on macOS.
GeorgePantazes commentedon Jun 25, 2019
In case anyone would like to weigh in on the Homebrew side, I've filed the homebrew issue here: Homebrew/homebrew-core#41338 .
terryjreedy commentedon Jun 26, 2019
It seems that the current warning
WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable. Visit
http://www.python.org/download/mac/tcltk/ for current information.
is not visible or strong enough to prevent spurious issues like this.
I would like to either 1. make it much more visible -- all caps or whatever -- stronger -- "is buggy, will eventually fail" -- and explicitly request "don't report problems if you continue"; or 2. require 8.5.15 or even 8.6.x and refuse to continue and exit.
Does IDLE every run long enough with Apple's tk before failure to make continuing useful?
Any comments here before I open a new issue?
ned-deily commentedon Jun 26, 2019
Yes, depending on what you are doing, IDLE *may* run just fine with the system Tk. But you may may run into this issue depending on how you scroll. Or, among the worst bugs, if you try to type in characters not directly available on the keyboard by using one of the available composition characters, like opt-u followed by a vowel to produced an "umlauted" vowel with the US keyboard layout, Tk will immediately crash taking IDLE with it and with no opportunity to save any work in progress. Many people will not run into those bugs but it can be very painful to those who do.
I don't think changing the message is going to make much of a difference. There isn't much an end user can do other to avoid the known behaviors that cause problems, install another version of Python (which may not be an option for many novice users), or not use IDLE. Back when we did not ship our own copy of Tcl/Tk with the python.org macOS installers, there *was* something else you might be able to do: install a more up-to-date third-party Tcl/Tk that would then be automatically used. But that's not longer an option nor is it needed.
I think the best thing we can do is help make it easier for people building Python to not link with the broken system Python and improve the using Python on macOS documentation. I have issues opened for both of those.