ratanakvlun / deluge-ltconfig

292 stars 35 forks source link

Can't activate ltconfig in options #22

Closed blakeaa827 closed 4 years ago

blakeaa827 commented 4 years ago

Hello! I'm trying to get ltconig to run in deluge2 and python3, but I keep running into issues. This one appears to be something I can't overcome myself. I'm running deluge from the official docker repo.

Environment info: deluged 2.0.3-2-201906121747-ubuntu18.04.1 libtorrent: 1.1.5.0 Python: 3.6.9 OS: Linux 5.4.34-0-virt

I compiled a fresh egg from inside the container to make sure it was compatible with the running version of python. It seams to have compiled okay. I added the egg to the plugin directory and restarted the container. I do see ltconfig in the plugins section of the web interface now. However, when I try to activate the plugin, I get the following error in deluged.log:

17:31:07 [ERROR ][deluge.pluginmanagerbase :154 ] Unable to instantiate plugin 'ltConfig' from '/config/plugins/ltConfig-0.3.1-py3.6.egg'! 17:31:07 [ERROR ][deluge.pluginmanagerbase :1343] No module named 'core' Traceback (most recent call last): File "/usr/lib/python3/dist-packages/deluge/pluginmanagerbase.py", line 148, in enable_plugin instance = cls(pluginname.replace('-', '')) File "/config/plugins/ltConfig-0.3.1-py3.6.egg/ltconfig/init.py", line 46, in init from core import Core as _plugin_cls ModuleNotFoundError: No module named 'core'

From what I can tell from here, it appears that this is due to the difference between how python2 and python3 handle import statements.

Am I missing something, or is this a bug resulting from the migration of python from version 2 to 3?

Thanks!

blakeaa827 commented 4 years ago

So, I've made a couple of changes to resolve this issue and one other.

When compiling the egg, I was getting the following error:

byte-compiling build/bdist.linux-x86_64/egg/ltconfig/core.py to core.cpython-36.pyc File "build/bdist.linux-x86_64/egg/ltconfig/core.py", line 324 except TypeError, ValueError: ^ SyntaxError: invalid syntax

I resolved that by editing core.py and adding parenthesis around "TypeError, ValueError". The egg now compiles without error.

Secondly, after compiling the egg, I was unable to enable the plugin from the web interface. Per above, this was due to the import statements. I updated all the import statements I could find with the leading "." to conform with python3. Now, those errors are not happening when I try to enable.

Next issue, I am now getting the following log entries when trying to enable the plugin:

18:36:36 [ERROR ][deluge.pluginmanagerbase :196 ] Failed to start plugin: ltConfig Traceback: <class 'RuntimeError'>: dictionary changed size during iteration /usr/lib/python3/dist-packages/twisted/internet/defer.py:150:maybeDeferred /usr/lib/python3/dist-packages/deluge/plugins/init.py:27:enable /config/plugins/ltConfig-0.3.1-py3.6.egg/ltconfig/core.py:100:enable /config/plugins/ltConfig-0.3.1-py3.6.egg/ltconfig/core.py:168:get_preset

18:36:36 [WARNING ][deluge.pluginmanagerbase :246 ] Problems occured disabling plugin: ltConfig

I'm looking into where to go from here. If I figure out what's going on, I'll update this thread.

blakeaa827 commented 4 years ago

Okay, resolved the runtime error using the method indicated here. I updated core.py on line 168 to use lists(settings) instead of settings.keys().

At this point, all errors have been resolved to my knowledge. There are no compile errors, and there are no runtime errors. When I enable the plugin from the web gui, the log reflects:

19:42:00 [INFO ][deluge.pluginmanagerbase :189 ] Plugin ltConfig enabled...

However, ltConfig does not get added to the list of configuration items on the left panel of the preferences window. At this point, I'm at a loss. Everything seems to be compiled and installed correctly, but there is no configuration section to manipulate the plugin...

blakeaa827 commented 4 years ago

I had no idea this project hadn't been updated for 3 years.