From 3030584ee3a8a969ba49cb90257cd2c5d68912bb Mon Sep 17 00:00:00 2001 From: Michael Hucka Date: Wed, 23 Sep 2020 19:39:31 -0700 Subject: [PATCH] Fix importing google-api-python-client This was a very nonobvious problem. The solution came from a GitHub issue report: https://github.com/googleapis/google-api-python-client/issues/876 --- pyinstaller-win32.spec | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pyinstaller-win32.spec b/pyinstaller-win32.spec index 4aba017..cf93fc7 100644 --- a/pyinstaller-win32.spec +++ b/pyinstaller-win32.spec @@ -9,6 +9,7 @@ import imp import os +from PyInstaller.utils.hooks import copy_metadata import sys # The list must contain tuples: ('file', 'destination directory'). @@ -16,6 +17,12 @@ data_files = [ ('lostit\lostit.ini', 'lostit'), ('lostit\data\client_secrets.json', 'lostit\data'), ('lostit\data\help.html', 'lostit\data') ] +# A breaking change in google-api-python-client caused the need for this. +# See https://github.com/googleapis/google-api-python-client/issues/876 +# This solution came from user Jay Lee in a comment on the issue at +# https://github.com/googleapis/google-api-python-client/issues/876#issuecomment-625779315 +data_files += copy_metadata('google-api-python-client') + configuration = Analysis([r'lostit\__main__.py'], pathex = ['.'], binaries = [], @@ -23,7 +30,7 @@ configuration = Analysis([r'lostit\__main__.py'], hiddenimports = ['apiclient', 'keyring.backends', 'wx._html', 'wx._xml', 'win32timezone', 'winreg'], - hookspath = [], + hookspath = ['pyinstaller-hooks'], runtime_hooks = [], excludes = [], win_no_prefer_redirects = False, @@ -43,11 +50,15 @@ executable = EXE(application_pyz, configuration.datas, name = 'LostIt', icon = r'dev\icons\generated-icons\lostit-icon-512px.ico', - debug = False, strip = False, upx = True, runtime_tmpdir = None, + # To debug run problems on Windows, first try setting + # console to True. If that doesn't reveal enough, then + # try setting debug to True. (Debug produces a lot of + # dialogs, so better to start with console.) console = False, + debug = False, ) app = BUNDLE(executable,