Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Cloud RuntimeError 3.2.6 #6358

Closed
huyle93 opened this issue Feb 1, 2018 · 4 comments
Closed

Google Cloud RuntimeError 3.2.6 #6358

huyle93 opened this issue Feb 1, 2018 · 4 comments

Comments

@huyle93
Copy link

huyle93 commented Feb 1, 2018

Description of your problem

The problem was from the previous version of Spyder, before the 3.2.6 and I thought 3.2.6 should fix this problem. However, it is still there when calling Google Cloud API.

Error:
RuntimeError: 'path' must be None or a list, not <class '_frozen_importlib_external._NamespacePath'>

Where is the error:
File "/Users/name/anaconda3/lib/python3.6/imp.py", line 271, in find_module "not {}".format(type(path)))

More details of the error code: https://stackoverflow.com/questions/48516018/anaconda-spyder-runtimeerror-imp-py-line-271

What steps will reproduce the problem?

  1. from google.cloud import someLibrary
  2. calling a function that uses any services from the google.cloud library
  3. sample:
    from google.cloud import language
    from google.cloud.language import enums
    from google.cloud.language import types
    import six
    import sys

   def entity_sentiment_text(text):
      client = language.LanguageServiceClient()

    if isinstance(text, six.binary_type):
        text = text.decode('utf-8')

    document = types.Document(
        content=text.encode('utf-8'),
        type=enums.Document.Type.PLAIN_TEXT)
    encoding = enums.EncodingType.UTF32
    if sys.maxunicode == 65535:
        encoding = enums.EncodingType.UTF16

    result = client.analyze_entity_sentiment(document, encoding)
    print(result.entities)

    print(entity_sentiment_text("my spyder has some problem"))

What is the expected output? What do you see instead?
The expected output is the json return from Google Cloud API.
I see the error that described above instead. Note, it works fine when I execute the program using terminal, PyCharm or VSCode (I assume other IDEs won't have this issue).

Please provide any additional information below
The program works fine when running from terminal and other IDEs

Versions and main components

  • Spyder Version: 3.2.6
  • Python Version: 3.6.3
  • Qt Version: 5.6.2
  • PyQt Version: Latest
  • Operating system: Mac OS 10.13.2

Dependencies

Please go to the menu entry Help > Optional Dependencies (or
Help > Dependencies), press the button Copy to clipboard
and paste the contents below:
IPython >=4.0 : 6.1.0 (OK)
cython >=0.21 : 0.26.1 (OK)
jedi >=0.9.0 : 0.11.1 (OK)
nbconvert >=4.0 : 5.3.1 (OK)
numpy >=1.7 : 1.13.3 (OK)
pandas >=0.13.1 : 0.20.3 (OK)
psutil >=0.3 : 5.4.3 (OK)
pycodestyle >=2.3: 2.3.1 (OK)
pyflakes >=0.6.0 : 1.6.0 (OK)
pygments >=2.0 : 2.2.0 (OK)
pylint >=0.25 : 1.8.2 (OK)
qtconsole >=4.2.0: 4.3.1 (OK)
rope >=0.9.4 : 0.10.7 (OK)
sphinx >=0.6.6 : 1.6.6 (OK)
sympy >=0.7.3 : 1.1.1 (OK)

@ccordoba12
Copy link
Member

Thanks for reporting. We'll take a look at this in a future release.

@CAM-Gerlach
Copy link
Member

Seems similar to #5121 and several others (that have been wontfixed)...

@ccordoba12
Copy link
Member

Sorry, I forgot this is a duplicate of issue #5299. Please read that issue for a temporary solution.

@ccordoba12 ccordoba12 removed this from the v3.2.8 milestone Feb 2, 2018
@MTHD486
Copy link

MTHD486 commented Feb 9, 2018

@ccordoba12 Hi, I have similar problems when calling Google Cloud API in Spyder. I tried to see #5299 but am not sure what is the temporary solution for this. According to the below link, I tried to comment out if HAS_PYXIMPORT: in sitecustomize.py but I still get the same error. May I ask how can I fix that problem? Many thx.

https://stackoverflow.com/questions/46422488/get-rid-of-pyximport

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants