Skip to content
This repository was archived by the owner on Aug 15, 2022. It is now read-only.
This repository was archived by the owner on Aug 15, 2022. It is now read-only.

Problems with importing plugins #94

@quulah

Description

@quulah
  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.

Description

Something causes problems in importing plugins from the bot's directory. Since the pip install installs plugins/repeat.py in Python's library directory, it overrides the one in the bot's directory.

My custom plugins are in /opt/rtmbot/plugins. I set the BASE_PATH to /opt/rtmbot, but that didn't help.

I tried installing in a virtualenv and with the system Python. System Python seems to work better for some reason.

I added a debug print of sys.path before the module loading code.

This is from the system Python install:

['/usr/local/bin',
 '/usr/lib/python36.zip',
 '/usr/lib/python3.6',
 '/usr/lib/python3.6/lib-dynload',
 '/usr/local/lib/python3.6/dist-packages',
 '/usr/lib/python3/dist-packages',
 '/opt/rtmbot']

And this is from the virtualenv:

['/opt/rtmbot/venv/bin',
 '/opt/rtmbot/venv/lib/python36.zip',
 '/opt/rtmbot/venv/lib/python3.6',
 '/opt/rtmbot/venv/lib/python3.6/lib-dynload',
 '/usr/lib/python3.6',
 '/opt/rtmbot/venv/lib/python3.6/site-packages',
 '/opt/rtmbot']

If I change /opt/rtmbot/plugins to /opt/rtmbot/more-plugins, for example, I can get the plugin to load.

Reproducible in:

  • This is reproducible in the sample project.
    RTMBot version: 0.4.1
    Python version: 3.6.6
    OS Version: Ubuntu 18.04

Expected result:

No import errors.

Actual result:

Rtmbot fails to start due to not finding my plugins.

Attachments:

The actual error:

Traceback (most recent call last):
  File "/opt/rtmbot/venv/bin/rtmbot", line 11, in <module>
    sys.exit(main())
  File "/opt/rtmbot/venv/lib/python3.6/site-packages/rtmbot/bin/run_rtmbot.py", line 31, in main
    bot.start()
  File "/opt/rtmbot/venv/lib/python3.6/site-packages/rtmbot/core.py", line 100, in start
    self._start()
  File "/opt/rtmbot/venv/lib/python3.6/site-packages/rtmbot/core.py", line 75, in _start
    self.load_plugins()
  File "/opt/rtmbot/venv/lib/python3.6/site-packages/rtmbot/core.py", line 160, in load_plugins
    cls = import_string(plugin_path)
  File "/opt/rtmbot/venv/lib/python3.6/site-packages/rtmbot/utils/module_loading.py", line 17, in import_string
    module = import_module(module_path)
  File "/opt/rtmbot/venv/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'plugins.cve'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions