panholt / sparkpy

Python 3.6 Module for Cisco Spark
MIT License
0 stars 1 forks source link

Import Errors License #6

Open btotharye opened 7 years ago

btotharye commented 7 years ago

Trying to use sparkpy from the pip install and getting the below from errbot:

ImportError: No module named 'License'
20:38:53 ERROR    errbot.bootstrap          Unable to load or configure the backend.
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/errbot/bootstrap.py", line 135, in setup_bot
    bot = backendpm.get_plugin_by_name(backend_name)
  File "/usr/local/lib/python3.5/dist-packages/errbot/specific_plugin_manager.py", line 86, in get_plugin_by_name
    raise Exception('Error loading plugin %s:\nError:\n%s\n' % (name, formatted_error))
Exception: Error loading plugin Cisco Spark:
Error:
<class 'ImportError'>:
  File "/usr/local/lib/python3.5/dist-packages/yapsy/PluginManager.py", line 488, in loadPlugins
    candidate_module = imp.load_module(plugin_module_name,plugin_file,candidate_filepath+".py",("py","r",imp.PY_SOURCE))
  File "/usr/lib/python3.5/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/usr/lib/python3.5/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 693, in _load
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 665, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/root/err-backend-cisco-spark/backend/cisco_spark.py", line 8, in <module>
    import sparkpy
  File "/usr/local/lib/python3.5/dist-packages/sparkpy/__init__.py", line 6, in <module>
    from License import License

Still looking into what might be causing it

panholt commented 7 years ago

Hey Brian,

Good to see you again.. this is not quite ready for prime time, but one problem I see is python3.5 and I'm using fstrings so 3.6 is needed.

Can you try 3.6 and see if there still a problem?

ps: where are you at these days. -Paul

btotharye commented 7 years ago

that worked @panholt I'm at Eplus now I'm looking at your spark backend now for some stuff I'm building over here and getting it going again, do you just setup the webhook now manually and how do you specify it in the config file now, I see the README changed some and now that part is gone.

btotharye commented 7 years ago

looks like on 3.6 having same errors from the pip package of sparkpy:

  File "/usr/local/lib/python3.6/dist-packages/yapsy/PluginManager.py", line 488, in loadPlugins
    candidate_module = imp.load_module(plugin_module_name,plugin_file,candidate_filepath+".py",("py","r",imp.PY_SOURCE))
  File "/usr/lib/python3.6/imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "/usr/lib/python3.6/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 684, in _load
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/root/err-backend-cisco-spark/backend/cisco_spark.py", line 8, in <module>
    import sparkpy
  File "/usr/local/lib/python3.6/dist-packages/sparkpy/__init__.py", line 6, in <module>
    from License import License
ModuleNotFoundError: No module named 'License'
13:01:16 ERROR    errbot.bootstrap          Unable to load or configure the backend.
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/errbot/bootstrap.py", line 135, in setup_bot
    bot = backendpm.get_plugin_by_name(backend_name)
  File "/usr/local/lib/python3.6/dist-packages/errbot/specific_plugin_manager.py", line 86, in get_plugin_by_name
    raise Exception('Error loading plugin %s:\nError:\n%s\n' % (name, formatted_error))
Exception: Error loading plugin Cisco Spark:
Error:
<class 'ModuleNotFoundError'>:
  File "/usr/local/lib/python3.6/dist-packages/yapsy/PluginManager.py", line 488, in loadPlugins
    candidate_module = imp.load_module(plugin_module_name,plugin_file,candidate_filepath+".py",("py","r",imp.PY_SOURCE))
  File "/usr/lib/python3.6/imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "/usr/lib/python3.6/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 684, in _load
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/root/err-backend-cisco-spark/backend/cisco_spark.py", line 8, in <module>
    import sparkpy
  File "/usr/local/lib/python3.6/dist-packages/sparkpy/__init__.py", line 6, in <module>
    from License import License
btotharye commented 7 years ago

btw got past all that by installing from your repo for sparkpy instead of from pypi. Only issue I'm seeing now:

13:38:08 ERROR    yapsy                     Unable to create plugin object: /root/err-backend-cisco-spark/backend/cisco_spark
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/yapsy/PluginManager.py", line 512, in loadPlugins
    plugin_info.plugin_object = self.instanciateElement(element)
  File "/usr/local/lib/python3.6/dist-packages/errbot/specific_plugin_manager.py", line 59, in instanciateElement
    return element(self._config)
  File "/root/err-backend-cisco-spark/backend/cisco_spark.py", line 177, in __init__
    self.spark = sparkpy.Spark(config.BOT_IDENTITY)
  File "/usr/local/lib/python3.6/dist-packages/sparkpy/spark.py", line 56, in __init__
    self._session = SparkSession(token)
  File "/usr/local/lib/python3.6/dist-packages/sparkpy/session.py", line 25, in __init__
    self.headers.update({'Authorization': 'Bearer ' + self._bearer_token,
TypeError: must be str, not dict
13:38:08 ERROR    errbot.bootstrap          Unable to load or configure the backend.
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/errbot/bootstrap.py", line 135, in setup_bot
    bot = backendpm.get_plugin_by_name(backend_name)
  File "/usr/local/lib/python3.6/dist-packages/errbot/specific_plugin_manager.py", line 86, in get_plugin_by_name
    raise Exception('Error loading plugin %s:\nError:\n%s\n' % (name, formatted_error))
Exception: Error loading plugin Cisco Spark:
Error:
<class 'TypeError'>:
  File "/usr/local/lib/python3.6/dist-packages/yapsy/PluginManager.py", line 512, in loadPlugins
    plugin_info.plugin_object = self.instanciateElement(element)
  File "/usr/local/lib/python3.6/dist-packages/errbot/specific_plugin_manager.py", line 59, in instanciateElement
    return element(self._config)
  File "/root/err-backend-cisco-spark/backend/cisco_spark.py", line 177, in __init__
    self.spark = sparkpy.Spark(config.BOT_IDENTITY)
  File "/usr/local/lib/python3.6/dist-packages/sparkpy/spark.py", line 56, in __init__
    self._session = SparkSession(token)
  File "/usr/local/lib/python3.6/dist-packages/sparkpy/session.py", line 25, in __init__
    self.headers.update({'Authorization': 'Bearer ' + self._bearer_token,
btotharye commented 7 years ago

seems like there is an issue with how the spark token is setup in errbot versus how the call is made to sparkpy that is causing the error

gtie commented 7 years ago

To clarify, the sparkpy module from pip is a completely different beast than this one. If you want to install the latest version of this one with pip, you can do pip install https://github.com/panholt/sparkpy/archive/master.zip

panholt commented 7 years ago

@gtie Thanks for letting me know. I don't know how I didn't come across that before. I will have to come up with a new name, opened https://github.com/panholt/sparkpy/issues/7 to track.