Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'deluge_client' #46

Open
Sonic3R opened this issue Nov 27, 2023 · 0 comments
Open

ModuleNotFoundError: No module named 'deluge_client' #46

Sonic3R opened this issue Nov 27, 2023 · 0 comments

Comments

@Sonic3R
Copy link

Sonic3R commented Nov 27, 2023

Hi,

I have created a class like

import logging

from torrent_clients.torrent_client import TorrentClient
from torrent_clients.torrent_data import TorrentData
from deluge_client import DelugeRPCClient

class DelugedClient(TorrentClient):
    def __init__(self, logger: logging.Logger, address: str, port: int, user: str, password: str) -> None:
        super().__init__(logger, address, port, user, password)
        
    def __get_torrent_client(self):
        if (
            len(self._address) == 0
            or len(self._pass) == 0
            or len(self._user) == 0
        ):
            raise  ValueError("Torrent client details are missing")

        client = DelugeRPCClient(self._address, self._port, self._user, self._pass, True)
        try:
            if not client.connected:
                client.connect()
            return client
        except Exception as e:
            self._logger.error(e)
            
        raise TypeError("Cannot initialise deluge client")
    
    def _get_torrent_list(self)->list[TorrentData]:
        client = self.__get_torrent_client()
        items:list[TorrentData] = []
        
        deluge_data = client.call("core.get_torrents_status", [], [])
        for key in deluge_data:
            obj = deluge_data[key]
            items.append(TorrentData(obj["name"], obj["hash"], obj["state"], obj["tracker"]))
            
        return items

    def _delete_torrent(self,torrent_id:str, delete_local_files: bool):
        client = self.__get_torrent_client()
        client.call("core.remove_torrent", [torrent_id], [delete_local_files])
    
    def _resume_torrent(self,torrent_ids:list[str]):
        client = self.__get_torrent_client()
        client.call("core.resume_torrents", torrent_ids, [])

and TorrentClient

class TorrentClient(abc.ABC):
   ...

When compile application, I get:

ModuleNotFoundError: No module named 'deluge_client'

Of course I ran:

pip install deluge-client

Seems to fail at

from deluge_client import DelugeRPCClient

But cannot figure out why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant