classification
Title: MacOS Touchpad scrolling crashes IDLE
Type: behavior Stage: resolved
Components: Tkinter Versions: Python 3.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: UnicodeDecodeError in OS X tkinter when binding to <MouseWheel>
View: 10731
Assigned To: Nosy List: George Pantazes, Rakesh Singh, ned.deily, terry.reedy, willingc
Priority: normal Keywords:

Created on 2019-06-24 22:23 by George Pantazes, last changed 2019-06-26 18:53 by ned.deily. This issue is now closed.

Messages (15)
msg346445 - (view) Author: George Pantazes (George Pantazes) Date: 2019-06-24 22:23
IDLE crashes if the user scrolls with the Mac mousepad (using two fingers, either up or down).

```$ python -m idlelib # Then I use the mousepad to scroll in the IDLE window
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
```

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)
msg346446 - (view) Author: George Pantazes (George Pantazes) Date: 2019-06-24 22:28
Also happens when I plug in a conventional mouse and use the mouse scrollwheel (so it's not just the touchpad scrolling!).
msg346462 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2019-06-25 00:36
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__)')
msg346480 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-06-25 02:59
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.
msg346482 - (view) Author: Carol Willing (willingc) * (Python committer) Date: 2019-06-25 04:26
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.
msg346527 - (view) Author: Rakesh Singh (Rakesh Singh) Date: 2019-06-25 13:49
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.



```
brew linkage python
System libraries:
  /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
  /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon
  /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
  /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
  /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
  /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration
  /System/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl
  /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk
  /usr/lib/libSystem.B.dylib
  /usr/lib/libbz2.1.0.dylib
  /usr/lib/libncurses.5.4.dylib
  /usr/lib/libobjc.A.dylib
  /usr/lib/libpanel.5.4.dylib
  /usr/lib/libz.1.dylib
Homebrew libraries:
  /usr/local/opt/gdbm/lib/libgdbm.6.dylib (gdbm)
  /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib (openssl)
  /usr/local/opt/openssl/lib/libssl.1.0.0.dylib (openssl)
  /usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/Python (python)
  /usr/local/opt/readline/lib/libreadline.8.dylib (readline)
  /usr/local/opt/sqlite/lib/libsqlite3.0.dylib (sqlite)
  /usr/local/opt/xz/lib/liblzma.5.dylib (xz)
```
msg346536 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2019-06-25 15:42
> 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 Issue10731 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/
msg346541 - (view) Author: Carol Willing (willingc) * (Python committer) Date: 2019-06-25 17:31
Thanks for the additional information Rakesh.
msg346542 - (view) Author: George Pantazes (George Pantazes) Date: 2019-06-25 17:54
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.

```
➜ python3 -m test.pythoninfo                                       
Python debug information
========================

CC.version: Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Py_DEBUG: No (sys.gettotalrefcount() missing)
_decimal.__libmpdec_version__: 2.4.2
builtins.float.double_format: IEEE, little-endian
builtins.float.float_format: IEEE, little-endian
core_config[_disable_importlib]: 0
core_config[allocator]: None
core_config[argv]: ['-m']
core_config[base_exec_prefix]: '/Users/georgep/Documents/workspace/r-tester/venv/bin/..'
core_config[base_prefix]: '/Users/georgep/Documents/workspace/r-tester/venv/bin/..'
core_config[coerce_c_locale]: 0
core_config[coerce_c_locale_warn]: 0
core_config[dev_mode]: 0
core_config[dump_refs]: 0
core_config[exec_prefix]: '/Users/georgep/Documents/workspace/r-tester/venv/bin/..'
core_config[executable]: '/Users/georgep/Documents/workspace/r-tester/venv/bin/python3'
core_config[faulthandler]: 0
core_config[hash_seed]: 0
core_config[home]: None
core_config[ignore_environment]: 0
core_config[import_time]: 0
core_config[install_signal_handlers]: 1
core_config[malloc_stats]: 0
core_config[module_search_path_env]: None
core_config[module_search_paths]: ['/Users/georgep/Documents/workspace/r-tester/venv/bin/../lib/python37.zip', '/Users/georgep/Documents/workspace/r-tester/venv/bin/../lib/python3.7', '/Users/georgep/Documents/workspace/r-tester/venv/bin/../lib/python3.7/lib-dynload']
core_config[prefix]: '/Users/georgep/Documents/workspace/r-tester/venv/bin/..'
core_config[program]: 'python3'
core_config[program_name]: 'python3'
core_config[show_alloc_count]: 0
core_config[show_ref_count]: 0
core_config[tracemalloc]: 0
core_config[use_hash_seed]: 0
core_config[utf8_mode]: 0
core_config[warnoptions]: []
core_config[xoptions]: []
datetime.datetime.now: 2019-06-25 10:50:02.453944
expat.EXPAT_VERSION: expat_2.2.6
global_config[Py_BytesWarningFlag]: 0
global_config[Py_DebugFlag]: 0
global_config[Py_DontWriteBytecodeFlag]: 0
global_config[Py_FileSystemDefaultEncodeErrors]: 'surrogateescape'
global_config[Py_FileSystemDefaultEncoding]: 'utf-8'
global_config[Py_FrozenFlag]: 0
global_config[Py_HasFileSystemDefaultEncoding]: 1
global_config[Py_HashRandomizationFlag]: 1
global_config[Py_IgnoreEnvironmentFlag]: 0
global_config[Py_InspectFlag]: 0
global_config[Py_InteractiveFlag]: 0
global_config[Py_IsolatedFlag]: 0
global_config[Py_NoSiteFlag]: 0
global_config[Py_NoUserSiteDirectory]: 0
global_config[Py_OptimizeFlag]: 0
global_config[Py_QuietFlag]: 0
global_config[Py_UTF8Mode]: 0
global_config[Py_UnbufferedStdioFlag]: 0
global_config[Py_VerboseFlag]: 0
locale.encoding: UTF-8
main_config[argv]: ['/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/test/pythoninfo.py']
main_config[base_exec_prefix]: '/Users/georgep/Documents/workspace/r-tester/venv/bin/..'
main_config[base_prefix]: '/Users/georgep/Documents/workspace/r-tester/venv/bin/..'
main_config[exec_prefix]: '/Users/georgep/Documents/workspace/r-tester/venv/bin/..'
main_config[executable]: '/Users/georgep/Documents/workspace/r-tester/venv/bin/python3'
main_config[install_signal_handlers]: 1
main_config[module_search_path]: ['/Users/georgep/Documents/workspace/r-tester', '/Users/georgep/Documents/workspace/r-tester/venv/lib/python37.zip', '/Users/georgep/Documents/workspace/r-tester/venv/lib/python3.7', '/Users/georgep/Documents/workspace/r-tester/venv/lib/python3.7/lib-dynload', '/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7', '/Users/georgep/Documents/workspace/r-tester/venv/lib/python3.7/site-packages']
main_config[prefix]: '/Users/georgep/Documents/workspace/r-tester/venv/bin/..'
main_config[warnoptions]: []
main_config[xoptions]: {}
os.cpu_count: 8
os.cwd: /Users/georgep/Documents/workspace/r-tester
os.environ[DISPLAY]: /private/tmp/com.apple.launchd.iXqE5VioqF/org.macosforge.xquartz:0
os.environ[HOME]: /Users/georgep
os.environ[LC_CTYPE]: en_US.UTF-8
os.environ[PATH]: /Users/georgep/Documents/workspace/r-tester/venv/bin:/Users/georgep/.rvm/gems/ruby-2.5.1/bin:/Users/georgep/.rvm/gems/ruby-2.5.1@global/bin:/Users/georgep/.rvm/rubies/ruby-2.5.1/bin:/Users/georgep/bin:/Users/georgep/.jenv/shims:/Users/georgep/.jenv/bin:/Users/georgep/.jenv/shims:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/munki:/opt/X11/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:/Users/georgep/.rvm/bin
os.environ[SHELL]: /bin/zsh
os.environ[TERM]: xterm-256color
os.environ[TMPDIR]: /var/folders/sv/5gh4tk990539nzhdt311pg0h000_fp/T/
os.environ[VIRTUAL_ENV]: /Users/georgep/Documents/workspace/r-tester/venv
os.gid: 20
os.groups: 20, 12, 61, 80, 33, 98, 100, 204, 250, 395, 398, 399
os.loadavg: (2.02685546875, 1.79248046875, 1.787109375)
os.login: georgep
os.name: posix
os.supports_bytes_environ: True
os.supports_effective_ids: ['access']
os.supports_fd: ['chdir', 'chmod', 'chown', 'listdir', 'pathconf', 'scandir', 'stat', 'statvfs', 'truncate', 'utime']
os.supports_follow_symlinks: ['access', 'chflags', 'chmod', 'chown', 'link', 'stat', 'utime']
os.uid: 10710
os.umask: 022
os.uname: posix.uname_result(sysname='Darwin', nodename='georgepmaclap.local', release='18.6.0', version='Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64', machine='x86_64')
platform.architecture: 64bit
platform.platform: Darwin-18.6.0-x86_64-i386-64bit
platform.python_implementation: CPython
pymem.allocator: pymalloc
pymem.with_pymalloc: True
readline._READLINE_LIBRARY_VERSION: 8.0
readline._READLINE_RUNTIME_VERSION: 0x800
readline._READLINE_VERSION: 0x800
resource.RLIMIT_AS: (9223372036854775807, 9223372036854775807)
resource.RLIMIT_CORE: (0, 9223372036854775807)
resource.RLIMIT_CPU: (9223372036854775807, 9223372036854775807)
resource.RLIMIT_DATA: (9223372036854775807, 9223372036854775807)
resource.RLIMIT_FSIZE: (9223372036854775807, 9223372036854775807)
resource.RLIMIT_MEMLOCK: (9223372036854775807, 9223372036854775807)
resource.RLIMIT_NOFILE: (10240, 9223372036854775807)
resource.RLIMIT_NPROC: (1418, 2128)
resource.RLIMIT_RSS: (9223372036854775807, 9223372036854775807)
resource.RLIMIT_STACK: (8388608, 67104768)
resource.pagesize: 4096
socket.hostname: georgepmaclap.local
sqlite3.sqlite_version: 3.28.0
sqlite3.version: 2.6.0
ssl.HAS_SNI: True
ssl.OPENSSL_VERSION: OpenSSL 1.0.2s  28 May 2019
ssl.OPENSSL_VERSION_INFO: (1, 0, 2, 19, 15)
ssl.OP_ALL: 0x800003ff
ssl.OP_NO_TLSv1_1: 0x10000000
sys._framework: Python
sys.abiflags: m
sys.api_version: 1013
sys.builtin_module_names: ('_abc', '_ast', '_codecs', '_collections', '_functools', '_imp', '_io', '_locale', '_operator', '_signal', '_sre', '_stat', '_string', '_symtable', '_thread', '_tracemalloc', '_warnings', '_weakref', 'atexit', 'builtins', 'errno', 'faulthandler', 'gc', 'itertools', 'marshal', 'posix', 'pwd', 'sys', 'time', 'xxsubtype', 'zipimport')
sys.byteorder: little
sys.dont_write_bytecode: False
sys.executable: /Users/georgep/Documents/workspace/r-tester/venv/bin/python3
sys.filesystem_encoding: utf-8/surrogateescape
sys.flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1, isolated=0, dev_mode=False, utf8_mode=0)
sys.float_info: sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2, rounds=1)
sys.float_repr_style: short
sys.hash_info: sys.hash_info(width=64, modulus=2305843009213693951, inf=314159, nan=0, imag=1000003, algorithm='siphash24', hash_bits=64, seed_bits=128, cutoff=0)
sys.hexversion: 50791408
sys.implementation: namespace(_multiarch='darwin', cache_tag='cpython-37', hexversion=50791408, name='cpython', version=sys.version_info(major=3, minor=7, micro=3, releaselevel='final', serial=0))
sys.int_info: sys.int_info(bits_per_digit=30, sizeof_digit=4)
sys.maxsize: 9223372036854775807
sys.maxunicode: 1114111
sys.path: ['/Users/georgep/Documents/workspace/r-tester', '/Users/georgep/Documents/workspace/r-tester/venv/lib/python37.zip', '/Users/georgep/Documents/workspace/r-tester/venv/lib/python3.7', '/Users/georgep/Documents/workspace/r-tester/venv/lib/python3.7/lib-dynload', '/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7', '/Users/georgep/Documents/workspace/r-tester/venv/lib/python3.7/site-packages']
sys.platform: darwin
sys.prefix: /Users/georgep/Documents/workspace/r-tester/venv/bin/..
sys.stderr.encoding: UTF-8/backslashreplace
sys.stdin.encoding: UTF-8/strict
sys.stdout.encoding: UTF-8/strict
sys.thread_info: sys.thread_info(name='pthread', lock='mutex+cond', version=None)
sys.version: 3.7.3 (default, Mar 27 2019, 09:23:15)  [Clang 10.0.1 (clang-1001.0.46.3)]
sys.version_info: sys.version_info(major=3, minor=7, micro=3, releaselevel='final', serial=0)
sysconfig[ABIFLAGS]: m
sysconfig[CC]: clang
sysconfig[CFLAGS]: -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers
sysconfig[CONFIG_ARGS]: '--prefix=/usr/local/opt/python' '--enable-ipv6' '--datarootdir=/usr/local/opt/python/share' '--datadir=/usr/local/opt/python/share' '--enable-framework=/usr/local/opt/python/Frameworks' '--enable-loadable-sqlite-extensions' '--without-ensurepip' '--with-dtrace' '--with-openssl=/usr/local/opt/openssl' '--without-gcc' 'MACOSX_DEPLOYMENT_TARGET=10.14' 'CFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers' 'LDFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk' 'CC=clang' 'PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig:/usr/local/opt/readline/lib/pkgconfig:/usr/local/opt/sqlite/lib/pkgconfig:/usr/local/opt/xz/lib/pkgconfig' 'PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.14'
sysconfig[HOST_GNU_TYPE]: x86_64-apple-darwin18.2.0
sysconfig[MACHDEP]: darwin
sysconfig[MULTIARCH]: darwin
sysconfig[OPT]: -DNDEBUG -g -fwrapv -O3 -Wall
sysconfig[PY_CFLAGS]: -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers
sysconfig[PY_CFLAGS_NODIST]: -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration
sysconfig[PY_CORE_LDFLAGS]: -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
sysconfig[PY_LDFLAGS]: -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
sysconfig[PY_STDMODULE_CFLAGS]: -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -I. -I./Include
sysconfig[Py_DEBUG]: 0
sysconfig[Py_ENABLE_SHARED]: 0
sysconfig[SHELL]: /bin/sh
sysconfig[SOABI]: cpython-37m-darwin
sysconfig[prefix]: /usr/local/opt/python/Frameworks/Python.framework/Versions/3.7
test_socket.HAVE_SOCKET_ALG: False
test_socket.HAVE_SOCKET_CAN: False
test_socket.HAVE_SOCKET_CAN_ISOTP: False
test_socket.HAVE_SOCKET_RDS: False
test_socket.HAVE_SOCKET_VSOCK: False
test_support.IPV6_ENABLED: True
test_support._is_gui_available: False
test_support.python_is_optimized: True
time.altzone: 18000
time.daylight: 1
time.get_clock_info(perf_counter): namespace(adjustable=False, implementation='mach_absolute_time()', monotonic=True, resolution=1e-09)
time.get_clock_info(time): namespace(adjustable=True, implementation='clock_gettime(CLOCK_REALTIME)', monotonic=False, resolution=1.0000000000000002e-06)
time.time: 1561477802.453899
time.timezone: 21600
time.tzname: ('CST', 'CDT')
tkinter.TCL_VERSION: 8.5
tkinter.TK_VERSION: 8.5
tkinter.info_patchlevel: 8.5.9
zlib.ZLIB_RUNTIME_VERSION: 1.2.11
zlib.ZLIB_VERSION: 1.2.11


➜ otool -L $(python3 -c 'import _tkinter;print(_tkinter.__file__)')
/Users/georgep/Documents/workspace/r-tester/venv/lib/python3.7/lib-dynload/_tkinter.cpython-37m-darwin.so:
        /System/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl (compatibility version 8.5.0, current version 8.5.9)
        /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk (compatibility version 8.5.0, current version 8.5.9)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)
```


@ 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:
1. Open the IDLE application
    * These steps work regardless of opening Idle 3.app via the finder GUI, or by running `python -m idlelib`
2. Before scrolling, do either of the following so IDLE receives the scroll
    1. 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.
    2. 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.
3. Scroll. To scroll, do either of the following:
    1. Scroll using the scrollwheel on a conventional external mouse.
    2. 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
4. The IDLE app will "crash" (close). If run from the command line, the UnicodeDecodeError exception will be shown.


@willingc

> What language and encoding are you using on your system? Are you using UTF-16?
I'm on UTF-8, here's some proof
```
➜ echo $LC_CTYPE
en_US.UTF-8
➜ echo $LANG

➜ locale charmap
UTF-8
➜ python -c "import sys; print(sys.stdout.encoding)"
UTF-8
```

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.
msg346543 - (view) Author: George Pantazes (George Pantazes) Date: 2019-06-25 18:03
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?
msg346545 - (view) Author: Carol Willing (willingc) * (Python committer) Date: 2019-06-25 18:29
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.
msg346551 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2019-06-25 19:38
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 Issue34956.  I plan to look into that shortly to see if we can make building with a third-party Tk easier on macOS.
msg346561 - (view) Author: George Pantazes (George Pantazes) Date: 2019-06-25 21:29
In case anyone would like to weigh in on the Homebrew side, I've filed the homebrew issue here: https://github.com/Homebrew/homebrew-core/issues/41338 .
msg346585 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-06-26 06:51
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?
msg346659 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2019-06-26 18:53
> 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.
History
Date User Action Args
2019-06-26 18:53:27ned.deilysetmessages: + msg346659
2019-06-26 06:51:48terry.reedysetmessages: + msg346585
2019-06-25 21:29:37George Pantazessetmessages: + msg346561
2019-06-25 19:38:28ned.deilysetmessages: + msg346551
2019-06-25 18:29:21willingcsetmessages: + msg346545
2019-06-25 18:03:07George Pantazessetmessages: + msg346543
2019-06-25 17:54:34George Pantazessetmessages: + msg346542
2019-06-25 17:31:37willingcsetmessages: + msg346541
2019-06-25 15:42:02ned.deilysetstatus: open -> closed
superseder: UnicodeDecodeError in OS X tkinter when binding to <MouseWheel>
messages: + msg346536

resolution: duplicate
stage: resolved
2019-06-25 13:49:52Rakesh Singhsetnosy: + Rakesh Singh
messages: + msg346527
2019-06-25 04:26:47willingcsetnosy: + willingc
messages: + msg346482
2019-06-25 02:59:18terry.reedysetassignee: terry.reedy ->
type: crash -> behavior
messages: + msg346480
components: + Tkinter, - IDLE
2019-06-25 00:36:08ned.deilysetnosy: + ned.deily
messages: + msg346462
2019-06-24 22:28:51George Pantazessetmessages: + msg346446
2019-06-24 22:23:36George Pantazescreate