ronaldoussoren / py2app

py2app is a Python setuptools command which will allow you to make standalone Mac OS X application bundles and plugins from Python scripts.
Other
352 stars 35 forks source link

Issue including Google API client modules when compiling #259

Closed ronaldoussoren closed 3 years ago

ronaldoussoren commented 5 years ago

Original report by Joseph Cranney (Bitbucket: jcranney11, ).


My application has a feature that uses the google-api-python-client module. It bundles without any errors however when I open the application and attempt to use the google related feature, it throws several errors.

#!cmd

WARNING:googleapiclient.discovery_cache:file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth
Traceback (most recent call last):
  File "/Users/jcranney11/Documents/Projects/sapp/flask-app/dist/app.app/Contents/Resources/lib/python3.6/googleapiclient/discovery_cache/__init__.py", line 36, in autodetect
ModuleNotFoundError: No module named 'google.appengine'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/jcranney11/Documents/Projects/app/flask-app/dist/app.app/Contents/Resources/lib/python3.6/googleapiclient/discovery_cache/file_cache.py", line 33, in <module>
ModuleNotFoundError: No module named 'oauth2client'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/jcranney11/Documents/Projects/app/flask-app/dist/App.app/Contents/Resources/lib/python3.6/googleapiclient/discovery_cache/file_cache.py", line 37, in <module>
ModuleNotFoundError: No module named 'oauth2client'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/jcranney11/Documents/Projects/app/flask-app/dist/app.app/Contents/Resources/lib/python3.6/googleapiclient/discovery_cache/__init__.py", line 41, in autodetect
  File "/Users/jcranney11/Documents/Projects/app/flask-app/dist/app.app/Contents/Resources/lib/python3.6/googleapiclient/discovery_cache/file_cache.py", line 41, in <module>
ImportError: file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth
INFO:googleapiclient.discovery:URL being requested: GET https://www.googleapis.com/discovery/v1/apis/compute/v1/rest
Exception in thread Thread-11:
Traceback (most recent call last):
  File "threading.pyc", line 916, in _bootstrap_inner
  File "threading.pyc", line 864, in run
  File "/Users/jcranney11/Documents/Projects/app/flask-app/dist/app.app/Contents/Resources/app.py", line 211, in multi_thread_google
  File "sneaker_suite.pyc", line 554, in create
  File "/Users/jcranney11/Documents/Projects/app/flask-app/dist/app.app/Contents/Resources/lib/python3.6/googleapiclient/_helpers.py", line 130, in positional_wrapper
  File "/Users/jcranney11/Documents/Projects/app/flask-app/dist/app.app/Contents/Resources/lib/python3.6/googleapiclient/discovery.py", line 222, in build
  File "/Users/jcranney11/Documents/Projects/app/flask-app/dist/app.app/Contents/Resources/lib/python3.6/googleapiclient/discovery.py", line 272, in _retrieve_discovery_doc
  File "httplib2/__init__.pyc", line 1396, in request
  File "httplib2/__init__.pyc", line 977, in __init__
  File "httplib2/__init__.pyc", line 152, in _build_ssl_context
NotADirectoryError: [Errno 20] Not a directory

My setup.py looks like this:

#!python

from setuptools import setup

APP = ['app.py']
APP_NAME = 'myApp'
DATA_FILES = ['config.json']
OPTIONS = {
    'site_packages': True,
    'iconfile': 'slogo.icns',
    'plist': {
        'CFBundleName': APP_NAME,
        'CFBundleDisplayName': APP_NAME
    },
    'packages': ['jinja2']
}

setup(
    app=APP,
    data_files=DATA_FILES,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
)

I have tried adding these modules as an 'includes' option and as a 'packages' option, however still no luck.

How can I manually include these modules since py2app isn't doing it for me?

ronaldoussoren commented 3 years ago

I can't debug this without a reproducer.