Now that Deluge 2.1.1 is the only version to use with Python 3.12+, my tool is not working.
The documentation at https://deluge-torrent.org/development/uiclient/ does not indicate what deluge client package is required, and where to obtain it.
I can't install deluge-client (pypi search) in a python 3.12 environment:
Code: Select all
$ pip3 install deluge-client
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
See /usr/share/doc/python3.12/README.venv for more information.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
Code: Select all
$ pip install deluge-client
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting deluge-client
Downloading https://files.pythonhosted.org/packages/f1/53/d6672ad7b44190d578ce7520822af34e7119760df9934cad4d730b0592a2/deluge-client-1.10.2.tar.gz
Installing collected packages: deluge-client
Running setup.py install for deluge-client ... done
Successfully installed deluge-client-1.10.2
WARNING: You are using pip version 19.2.3, however version 20.3.4 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Code: Select all
$ python tmonitor.py
Traceback (most recent call last):
File "tmonitor.py", line 3, in <module>
from deluge.ui.client import client
ImportError: No module named deluge.ui.client
Code: Select all
import math
import sys
from deluge.ui.client import client
from twisted.internet import reactor
class DelugeInfo:
def __init__(self):
self.records = []
self.categories = []
self.torrents_status = []
try:
d = client.connect()
d.addCallback(self.on_connect_successful)
d.addErrback(self.on_connect_fail)
reactor.run()
except Exception as e:
self.logError("Error: " + str(e))
def on_get_torrents_status(self, torrents_status):
self.torrents_status = torrents_status
client.disconnect()
reactor.stop()
def on_connect_successful(self, result):
print("Connection Successful")
client.core.get_torrents_status("", "").addCallback(self.on_get_torrents_status)
def on_connect_fail(self, result):
print("Connection Failed!")
def writeOutput(self):
print("Write Output")
def logError(self, text):
print("Line 38: " + text + "\n")
def main():
delugeInfo = DelugeInfo()
# delugeInfo.writeOutput()
if __name__ == '__main__':
main()
sys.exit()