"No module named 'google' " in app using the YouTube Data API

82 views
Skip to first unread message

jim kaubisch

unread,
Mar 1, 2019, 12:18:54 PM3/1/19
to web2py-users
Hi,
I've successfully used this API for several years in this app (but with Python 2.7). never seen this in the past. 
Happens, not surprisingly, when importing/initializing the YouTube Data API. No other Google API's used
Environment is web2py 2.18.2, Python 3.7.2, macOS Mojave

These are the imports in this module:

    import os
    import sys
    PY2K = sys.version_info[0] == 2

    import json
    import errno
    if PY2K:
        import httplib
    else:
        import http.client
    import httplib2

    # Google YouTube API related imports
    from apiclient.discovery    import build
    from apiclient.errors       import HttpError
    from apiclient.http         import MediaFileUpload
    from oauth2client.client    import flow_from_clientsecrets
    from oauth2client.file      import Storage
    from oauth2client.tools     import argparser, run_flow

    from time     import strftime
    from operator import itemgetter

and here is the stream of tracebacks
--------------------
Traceback (most recent call last):
  File "... /web2py/gluon/custom_import.py", line 77, in custom_importer
    return NATIVE_IMPORTER(oname, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'google'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File " ... /web2py/gluon/custom_import.py", line 98, in custom_importer
    return base_importer(pname, globals, locals, fromlist, level)
  File " ... /web2py/gluon/custom_import.py", line 137, in __call__
    result = NATIVE_IMPORTER(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'applications.MFMCurrAssetMgr.modules.google'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File " ... /web2py/gluon/custom_import.py", line 102, in custom_importer
    return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'google'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/googleapiclient/discovery_cache/__init__.py", line 36, in autodetect
    from google.appengine.api import memcache
  File " ... /web2py/gluon/custom_import.py", line 104, in custom_importer
    raise ImportError(e1, import_tb)  # there an import error in the module
ImportError: (ModuleNotFoundError("No module named 'applications.MFMCurrAssetMgr.modules.google'"), <traceback object at 0x113569388>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File " ... /web2py/gluon/custom_import.py", line 77, in custom_importer
    return NATIVE_IMPORTER(oname, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'oauth2client.contrib.locked_file'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File " ... /web2py/gluon/custom_import.py", line 98, in custom_importer
    return base_importer(pname, globals, locals, fromlist, level)
  File " ... /web2py/gluon/custom_import.py", line 137, in __call__
    result = NATIVE_IMPORTER(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'applications.MFMCurrAssetMgr.modules.oauth2client'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File " ... /web2py/gluon/custom_import.py", line 102, in custom_importer
    return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'oauth2client.contrib.locked_file'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/googleapiclient/discovery_cache/file_cache.py", line 33, in <module>
    from oauth2client.contrib.locked_file import LockedFile
  File " ... /web2py/gluon/custom_import.py", line 104, in custom_importer
    raise ImportError(e1, import_tb)  # there an import error in the module
ImportError: (ModuleNotFoundError("No module named 'applications.MFMCurrAssetMgr.modules.oauth2client'"), <traceback object at 0x113577a88>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File " ... /web2py/gluon/custom_import.py", line 77, in custom_importer
    return NATIVE_IMPORTER(oname, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'oauth2client.locked_file'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File " ... /web2py/gluon/custom_import.py", line 98, in custom_importer
    return base_importer(pname, globals, locals, fromlist, level)
  File " ... /web2py/gluon/custom_import.py", line 137, in __call__
    result = NATIVE_IMPORTER(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'applications.MFMCurrAssetMgr.modules.oauth2client'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File " ... /web2py/gluon/custom_import.py", line 102, in custom_importer
    return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'oauth2client.locked_file'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/googleapiclient/discovery_cache/file_cache.py", line 37, in <module>
    from oauth2client.locked_file import LockedFile
  File " ... /web2py/gluon/custom_import.py", line 104, in custom_importer
    raise ImportError(e1, import_tb)  # there an import error in the module
ImportError: (ModuleNotFoundError("No module named 'applications.MFMCurrAssetMgr.modules.oauth2client'"), <traceback object at 0x113577e48>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/googleapiclient/discovery_cache/__init__.py", line 41, in autodetect
    from . import file_cache
  File " ... /web2py/gluon/custom_import.py", line 111, in custom_importer
    return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/googleapiclient/discovery_cache/file_cache.py", line 41, in <module>

Jim S

unread,
Nov 8, 2019, 9:33:00 AM11/8/19
to web2py-users
I'm having the same problem.  Not with the google package but with my own.

I'm trying to import:

from qlf import util

But, the custom importer is trying to import:

applications.connect.modules.qlf

...which doesn't exist ('connect' is my application name)

Anyone solve this?

-Jim

Jim Steil

unread,
Nov 8, 2019, 10:53:57 AM11/8/19
to web...@googlegroups.com
I found my problem.

One of my sub-modules was silently failing to install.  Fixed that and now all importing fine.

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/oG6It2B3VEA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/ff1bf382-eb25-425e-8505-dbd34075756b%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages