tkinter-import
authorMatthias Klose <doko@debian.org>
Mon, 5 Oct 2020 20:56:51 +0000 (21:56 +0100)
committerMatthias Klose <doko@debian.org>
Mon, 5 Oct 2020 20:56:51 +0000 (21:56 +0100)
# DP: suggest installation of python-tk package on failing _tkinter import

# DP: suggest installation of python-tk package on failing _tkinter import

Gbp-Pq: Name tkinter-import.diff

Lib/tkinter/__init__.py

index 1067ab6a8b8a1d9b730a354ad38c41e435e7cdd8..aaf880c54fa5f5aa2dcea1012078b094164ea187 100644 (file)
@@ -34,7 +34,10 @@ import enum
 import sys
 import types
 
-import _tkinter # If this fails your Python may not be configured for Tk
+try:
+    import _tkinter
+except ImportError as msg:
+    raise ImportError(str(msg) + ', please install the python3-tk package')
 TclError = _tkinter.TclError
 from tkinter.constants import *
 import re