From 7ea9580a9b06ed38ed605cfc2712303a0e60515e Mon Sep 17 00:00:00 2001 From: Paul Roberts Date: Thu, 16 Jun 2016 16:29:58 -0700 Subject: [PATCH] Fixed "failed to execute script gui" error when running under PyInstaller. PyInstaller looks for import statements to determine the script's dependencies. The two Tkinter imports with different capitalization ('Tkinter' and 'tkinter') seemed to confuse the latest version of PyInstaller, and it wasn't including Tkinter in the packaged binary at all, even with --hidden-import Tkinter. The lowercase "tkinter" fallback import is for Python 3 compatibility, and since the script can't currently run under Python 3 for various other reasons, I removed the import. PyInstaller binaries now work again. --- spatialmedia/gui.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/spatialmedia/gui.py b/spatialmedia/gui.py index 28250cd..f9c7d7e 100755 --- a/spatialmedia/gui.py +++ b/spatialmedia/gui.py @@ -28,11 +28,8 @@ try: from Tkinter import * except ImportError: - try: - from tkinter import * - except ImportError: - print("Tkinter library is not available.") - exit(0) + print("Tkinter library is not available.") + exit(0) path = os.path.dirname(sys.modules[__name__].__file__) path = os.path.join(path, '..')