mdziekon / octoprint-spoolman

An OctoPrint plugin integrating with Spoolman, a universal filament spools inventory manager.
GNU Affero General Public License v3.0
27 stars 3 forks source link

Support installing plugin from a `.zip` file #10

Closed mdziekon closed 7 months ago

mdziekon commented 7 months ago

Description

Currently it seems Octoprint does not correctly recognise the plugin when installing via .zip file.

It seems it does install all the dependencies and recognises the plugin in installation logs, but the final outcome is:

Installed unknown

Later, the plugin is nowhere to be found in the installed plugins list.

To make it deployable, this problem should be fixed.

mdziekon commented 7 months ago

Looks like the problem is caused by plugin's code:

octoprint[153702]: 2024-03-19 13:28:30,018 - octoprint.plugin.core - ERROR - Error loading plugin Spoolman
octoprint[153702]: Traceback (most recent call last):
octoprint[153702]:   File "/home/octoprint/lib/python3.11/site-packages/octoprint/plugin/core.py", line 1294, in _import_plugin
octoprint[153702]:     module = _load_module(module_name, spec)
octoprint[153702]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
octoprint[153702]:   File "/home/octoprint/lib/python3.11/site-packages/octoprint/plugin/core.py", line 52, in _load_module
octoprint[153702]:     return imp.load_module(name, f, filename, details)
octoprint[153702]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
octoprint[153702]:   File "/home/octoprint/lib/python3.11/site-packages/octoprint/vendor/imp.py", line 238, in load_module
octoprint[153702]:     return load_package(name, filename)
octoprint[153702]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
octoprint[153702]:   File "/home/octoprint/lib/python3.11/site-packages/octoprint/vendor/imp.py", line 212, in load_package
octoprint[153702]:     return _load(spec)
octoprint[153702]:            ^^^^^^^^^^^
octoprint[153702]:   File "<frozen importlib._bootstrap>", line 721, in _load
octoprint[153702]:   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
octoprint[153702]:   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
octoprint[153702]:   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
octoprint[153702]:   File "/home/octoprint/lib/python3.11/site-packages/octoprint_Spoolman/__init__.py", line 4, in <module>
octoprint[153702]:     from octoprint_Spoolman.SpoolmanPlugin import SpoolmanPlugin
octoprint[153702]:   File "/home/octoprint/lib/python3.11/site-packages/octoprint_Spoolman/SpoolmanPlugin.py", line 4, in <module>
octoprint[153702]:     from octoprint_Spoolman.modules.PluginAPI import PluginAPI
octoprint[153702]: ModuleNotFoundError: No module named 'octoprint_Spoolman.modules'
mdziekon commented 7 months ago

Fixed with 2a60252.

Changes introduced: