title: Anaconda Spyder RuntimeError (imp.py line 271)
body: <p>I get this error while running a sample code from Google Cloud API, but i assume this has nothing related to the API. </p>
  
  <pre><code>File "/Users/MyName/anaconda3/lib/python3.6/imp.py", line 271, in
  find_module
  
  "not {}".format(type(path)))
  
  RuntimeError: 'path' must be None or a list, not
  &lt;class'_frozen_importlib_external._NamespacePath'&gt;
  </code></pre>
  
  <p>Here is the Python code that i run</p>
  
  <pre><code>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):
      """Detects entity sentiment in the provided 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)
  
  # Detect and send native Python encoding to receive correct word 
  offsets.
  encoding = enums.EncodingType.UTF32
  if sys.maxunicode == 65535:
      encoding = enums.EncodingType.UTF16
  
  result = client.analyze_entity_sentiment(document, encoding)
  
  for entity in result.entities:
      print('Mentions: ')
      print(u'Name: "{}"'.format(entity.name))
      for mention in entity.mentions:
          print(u'  Begin Offset : {}'.format(mention.text.begin_offset))
          print(u'  Content : {}'.format(mention.text.content))
          print(u'  Magnitude : {}'.format(mention.sentiment.magnitude))
          print(u'  Sentiment : {}'.format(mention.sentiment.score))
          print(u'  Type : {}'.format(mention.type))
      print(u'Salience: {}'.format(entity.salience))
      print(u'Sentiment: {}\n'.format(entity.sentiment))
  </code></pre>
  
  <p>I did some research, some people suggest to add <strong>init</strong>.py, but i do have it in my directory. I wonder is there something wrong with spyder? While i run this file on Terminal using python to call the file, it works fine.</p>
  
  <p>Here is the error points to:</p>
  
  <pre><code>def find_module(name, path=None):
      """**DEPRECATED**
  
      Search for a module.
  
      If path is omitted or None, search for a built-in, frozen or 
      special
      module and continue search in sys.path. The module name cannot
      contain '.'; to search for a submodule of a package, pass the
      submodule name and the package's __path__.
  
      """
      if not isinstance(name, str):
          raise TypeError("'name' must be a str, not 
          {}".format(type(name)))
      elif not isinstance(path, (type(None), list)):
          # Backwards-compatibility
   **ERR ==&gt;**    raise RuntimeError("'path' must be None or a list, "
                             "not {}".format(type(path)))
  
      if path is None:
          if is_builtin(name):
              return None, None, ('', '', C_BUILTIN)
          elif is_frozen(name):
              return None, None, ('', '', PY_FROZEN)
          else:
              path = sys.path
  
      for entry in path:
          package_directory = os.path.join(entry, name)
          for suffix in ['.py', machinery.BYTECODE_SUFFIXES[0]]:
              package_file_name = '__init__' + suffix
              file_path = os.path.join(package_directory, 
           package_file_name)
              if os.path.isfile(file_path):
                  return None, package_directory, ('', '', PKG_DIRECTORY)
          for suffix, mode, type_ in get_suffixes():
              file_name = name + suffix
              file_path = os.path.join(entry, file_name)
              if os.path.isfile(file_path):
                  break
          else:
              continue
          break  # Break out of outer loop when breaking out of inner 
       loop.
      else:
          raise ImportError(_ERR_MSG.format(name), name=name)
  
      encoding = None
      if 'b' not in mode:
          with open(file_path, 'rb') as file:
              encoding = tokenize.detect_encoding(file.readline)[0]
      file = open(file_path, mode, encoding=encoding)
      return file, file_path, (suffix, mode, type_)
  </code></pre>