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

IndexError: list index out of range #5

Closed
dmemedo opened this issue May 30, 2021 · 16 comments
Closed

IndexError: list index out of range #5

dmemedo opened this issue May 30, 2021 · 16 comments
Assignees

Comments

@dmemedo
Copy link

dmemedo commented May 30, 2021

Hello,

I encounter this error when script is runned by deluge.
When I run it manually, I do get the discord notification.

When I tried to debug, it seems that when I deluge-command is run, I get :

[ERROR   ][deluge.common:131 ] Unable to use default config directory, exiting... ([Errno 13] Permission denied: \'/root/.config\')

any idea how to solve please?

PS: I use deluge 2 with python3

@ckcr4lyf
Copy link
Owner

@dmemedo in the file delugePushConfig.py, did you change DELUGE_VERSION to 2.x.y or something? The default 1.3.15 expects a different number of arguments.

@dmemedo
Copy link
Author

dmemedo commented May 31, 2021

Yes : DELUGE_VERSION = "2.0.3"

When I print the content of lines I find Unable to use default config directory, exiting... ([Errno 13] Permission denied: \'/root/.config\')

but when I execute the command manually, it works.
I also verified the value of delugeCommand and it's correct

@ckcr4lyf
Copy link
Owner

All right, I think this is something more to do with how Deluge is looking for its config. Are you on a dedicated seedbox? And does this happen on the "Torrent Added" or "Torrent Complete" step? If it is "Torrent Added", are you running a "reannounce" script? Does that work fine?

Looks like the way Deluge is installed, it is unable to load its own configuration, and hence unable to run the script. (Manually running the script with python hence works).

Specifically, Deluge should call the script and pass it some default arguments (hash, torrent name, download path). I believe this step is not working.

@ckcr4lyf ckcr4lyf self-assigned this May 31, 2021
@dmemedo
Copy link
Author

dmemedo commented May 31, 2021

  • The script fails for both "Torrent Added" and"Torrent Complete" and not running the reannounce script
  • I'm running deluge using linuxserver/deluge image

You must be right, it's related to the way deluge retrieves it's config, but the parameters are correctly passed since I can see the hash when I print the delugeCommand

PS: if you want me to test some specific behavior, feel free to ask

@ckcr4lyf
Copy link
Owner

> I'm running deluge using linuxserver/deluge image

I think this is it. Because the execute plugin operates within the context of the docker image, when it runs deluge-console, the place it looks for the config file is not accessible, hence it is erroring out.

When you say the manual test works, is it in the context of your root server, or within the image? Could you try running the delugeCommand, i.e. deluge-console "connect .... (i.e. execute deluge-console, not the python script) from within the context of the image?

I've not used linuxserver/deluge before, but their page does indicate they have a shell within the image.

@dmemedo
Copy link
Author

dmemedo commented May 31, 2021

During my testing, both deluge-console "connect .... and the python script work from with the container

@ckcr4lyf
Copy link
Owner

ckcr4lyf commented Jun 2, 2021

It's hard to outline the cause then, especially since deluge-console from within the container works. I'll try and get a VPS to run this image on, and see what I can reproduce.

@ckcr4lyf
Copy link
Owner

Hey @dmemedo , were you able to resolve the issue? I believe it may be related to permissions. Perhaps the discussion at #6 (comment) & #10 (comment) might be of help

@LeCommonMan
Copy link

LeCommonMan commented Feb 18, 2023

Hey @dmemedo , were you able to resolve the issue? I believe it may be related to permissions. Perhaps the discussion at #6 (comment) & #10 (comment) might be of help

hey @ckcr4lyf not sure if i create a new issue or post here.
here it goes.

Platform information:
deluge: 1.3.15
libtorrent: 1.1.5.0
Python 2.7.17

Error:

Traceback (most recent call last):
  File "delugePush.py", line 127, in <module>
    getState(torrentHash, torrentName, RATIO_CHECK_DELAY, False)
  File "delugePush.py", line 98, in getState
    sendMessage('Added torrent!', torrentNameMessage, tracker)
  File "delugePush.py", line 43, in sendMessage
    response = urllib2.urlopen(req)
  File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 435, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 548, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 473, in error
    return self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 556, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 400: Bad Request

did a chmod 777 in the directory and for once it thrown this error:

Traceback (most recent call last):
  File "delugePush.py", line 127, in <module>
    getState(torrentHash, torrentName, RATIO_CHECK_DELAY, False)
  File "delugePush.py", line 97, in getState
    if (lines[3].find('State: Downloading') == 0):
IndexError: list index out of range

and afterwords again the first error.

any idea how we short this out ?

@ckcr4lyf
Copy link
Owner

The first error seems the discord webhook URL may be incorrect, could you check that?

For the second on, you're getting it after the chmod ? Can you clarify if your setup is on a shared seedbox or some kinda docker thing?

@ckcr4lyf
Copy link
Owner

Also could you share what command you're using to test? Maybe the infohash doesn't exist in deluge

@LeCommonMan
Copy link

LeCommonMan commented Feb 21, 2023

Also could you share what command you're using to test? Maybe the infohash doesn't exist in deluge

I just grabbed the updated files and configured from scratch.
Everything works now,

@ckcr4lyf
Copy link
Owner

Glad to hear it. Will close this issue.

@LeCommonMan
Copy link

LeCommonMan commented Feb 21, 2023

Glad to hear it. Will close this issue.

just 1 min late replying

python ~/bin/delugePush.py fa45dceb288dcd135c537f66d8f3b0847f3d3530

working fine, when testing from console.

but not from execute command ( ~/bin/delugePush.py )

@ckcr4lyf ckcr4lyf reopened this Feb 21, 2023
@ckcr4lyf
Copy link
Owner

If it is working from the console, I would suggest the following:

  • Make sure the script is executable (chmod +x delugePush.py)
  • Make sure you restarted Deluge after adding the "Torrent Added" and "Torrent Completed" rules
  • Pass the complete path in the deluge setup (not ~/path/to/file.py)

@LeCommonMan
Copy link

LeCommonMan commented Feb 21, 2023

Make sure you restarted Deluge after adding the "Torrent Added" and "Torrent Completed" rules

this was the issue! Deluge restart fixed the problem,
( we can close this bug now)

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

3 participants