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

Python error #47

Closed
jgosnell56 opened this issue Dec 6, 2021 · 27 comments · Fixed by #51 or #65
Closed

Python error #47

jgosnell56 opened this issue Dec 6, 2021 · 27 comments · Fixed by #51 or #65
Labels
bug Something isn't working

Comments

@jgosnell56
Copy link

jgosnell56 commented Dec 6, 2021

I am receiving this error at random times.
[2021-12-05 23:02:46,724] [INFO] |====================================================================================================| [2021-12-05 23:02:46,725] [INFO] | Starting Run | [2021-12-05 23:02:46,725] [INFO] |====================================================================================================| [2021-12-05 23:02:46,725] [INFO] |======================================= Getting Torrent List =======================================| [2021-12-05 23:02:46,742] [INFO] |========================================== Updating Tags ===========================================| [2021-12-05 23:02:46,770] [CRITICAL] | Traceback (most recent call last): | [2021-12-05 23:02:46,770] [CRITICAL] | File "//qbit_manage.py", line 991, in <module> | schedule.run_pending() [2021-12-05 23:02:46,771] [CRITICAL] | File "/usr/local/lib/python3.9/site-packages/schedule/__init__.py", line 780, in run_pending | default_scheduler.run_pending() [2021-12-05 23:02:46,771] [CRITICAL] | File "/usr/local/lib/python3.9/site-packages/schedule/__init__.py", line 100, in run_pending | self._run_job(job) [2021-12-05 23:02:46,771] [CRITICAL] | File "/usr/local/lib/python3.9/site-packages/schedule/__init__.py", line 172, in _run_job | ret = job.run() [2021-12-05 23:02:46,772] [CRITICAL] | File "/usr/local/lib/python3.9/site-packages/schedule/__init__.py", line 661, in run | ret = self.job_func() [2021-12-05 23:02:46,772] [CRITICAL] | File "//qbit_manage.py", line 954, in start | set_tags() [2021-12-05 23:02:46,772] [CRITICAL] | File "//qbit_manage.py", line 465, in set_tags | new_tag,url,max_ratio,max_seeding_time,limit_upload_speed = get_tags([x.url for x in torrent.trackers if x.url.startswith('http')]) [2021-12-05 23:02:46,773] [CRITICAL] | File "//qbit_manage.py", line 215, in get_tags | url = trunc_val(urls[0], '/') [2021-12-05 23:02:46,773] [CRITICAL] | IndexError: list index out of range
My installation is on UnRaid. I have tried to re-deploy the container but get the same error randomly. No set time interval between failure. I am attaching config file and full log file.
activity.log
config.txt
s.

@bobokun
Copy link
Collaborator

bobokun commented Dec 6, 2021

Can you please switch over to the develop branch in your docker by switching your repository to bobokun/qbit_manage:develop in your unraid template. Can you please also change your QBT_LOG_LEVEL environment variable to DEBUG? You will need to click on show more settings in your Unraid template in order to see it.

image

Then start up the container and if you see any debug messages please send me the new log or the debug message.

@jgosnell56
Copy link
Author

jgosnell56 commented Dec 6, 2021 via email

@jgosnell56
Copy link
Author

jgosnell56 commented Dec 8, 2021

Container just stopped. Here is the relevant portion of the log.

[2021-12-07 09:28:13,594] qbit_manage.py [DEBUG] | Tracker Urls:[] |
[2021-12-07 09:28:13,595] qbit_manage.py [DEBUG] | list index out of range |
[2021-12-07 09:28:13,603] util.py [CRITICAL] | Traceback (most recent call last): |
[2021-12-07 09:28:13,604] util.py [CRITICAL] | File "//qbit_manage.py", line 995, in
| schedule.run_pending()
[2021-12-07 09:28:13,604] util.py [CRITICAL] | File "/usr/local/lib/python3.9/site-packages/schedule/init.py", line 780, in run_pending
| default_scheduler.run_pending()
[2021-12-07 09:28:13,604] util.py [CRITICAL] | File "/usr/local/lib/python3.9/site-packages/schedule/init.py", line 100, in run_pending
| self._run_job(job)
[2021-12-07 09:28:13,605] util.py [CRITICAL] | File "/usr/local/lib/python3.9/site-packages/schedule/init.py", line 172, in _run_job
| ret = job.run()
[2021-12-07 09:28:13,605] util.py [CRITICAL] | File "/usr/local/lib/python3.9/site-packages/schedule/init.py", line 661, in run
| ret = self.job_func()
[2021-12-07 09:28:13,606] util.py [CRITICAL] | File "//qbit_manage.py", line 958, in start
| set_tags()
[2021-12-07 09:28:13,606] util.py [CRITICAL] | File "//qbit_manage.py", line 469, in set_tags
| new_tag,url,max_ratio,max_seeding_time,limit_upload_speed = get_tags([x.url for x in torrent.trackers if x.url.startswith('http')])
[2021-12-07 09:28:13,606] util.py [CRITICAL] | File "//qbit_manage.py", line 243, in get_tags
| return (new_tag,url,max_ratio,max_seeding_time,limit_upload_speed)
[2021-12-07 09:28:13,607] util.py [CRITICAL] | UnboundLocalError: local variable 'url' referenced before assignment

log.txt

@bobokun
Copy link
Collaborator

bobokun commented Dec 8, 2021

okay, seems like one of your torrents doesn't have a tracker URL attached to it. So I'll end up skipping that torrent because there will be no way to know how to tag it without the tracker url. I've updated development branch so it shouldn't error anymore. Please update again

@jgosnell56
Copy link
Author

jgosnell56 commented Dec 8, 2021 via email

@bobokun
Copy link
Collaborator

bobokun commented Dec 8, 2021

Yeah that's something that needs to be fixed once I figure out how to do that...for now just run this command
chmod 777 -R /mnt/user/appdata/qbit_manage/

@jgosnell56
Copy link
Author

jgosnell56 commented Dec 8, 2021 via email

@bobokun
Copy link
Collaborator

bobokun commented Dec 8, 2021

As long as you don't delete the file it should be okay I think.

@bobokun
Copy link
Collaborator

bobokun commented Dec 13, 2021

I'm closing this issue since I haven't heard back from a while. Let me know if you do experience any issues.

@bobokun bobokun closed this as completed Dec 13, 2021
@jgosnell56
Copy link
Author

jgosnell56 commented Dec 13, 2021 via email

@jgosnell56
Copy link
Author

jgosnell56 commented Dec 14, 2021

I am now seeing this in the logs. Thoughts?
log.txt

This is from version 3.0.0

@bobokun
Copy link
Collaborator

bobokun commented Dec 14, 2021

yeah you have a duplicate key in your tags config for hdme. So you need to either use format 1 or format 2, not both. The new version puts more checks in place to make sure the config is correct.

@jgosnell56
Copy link
Author

Ok, I will modify the config. I completely missed the "Tag Parameters (Use either Format 1 or Format 2)" comment line in the config file. Thanks again.

@jgosnell56
Copy link
Author

Container stopped again over night. Sorry to keep bothering you
log.txt
.

@bobokun
Copy link
Collaborator

bobokun commented Dec 14, 2021

Not a bother at all. I'm glad you share these bugs with me so I can fix them :) Okay this should be fixed now in the latest develop. Please let me know if you do find any new issues or crashing.

@bobokun bobokun added the bug Something isn't working label Dec 14, 2021
@bobokun bobokun mentioned this issue Dec 15, 2021
@jgosnell56
Copy link
Author

jgosnell56 commented Dec 15, 2021

Another one.

[2021-12-14 23:30:36,715] util.py [CRITICAL] | Traceback (most recent call last): |
|
[2021-12-14 23:30:36,716] util.py [CRITICAL] | File "//qbit_manage.py", line 267, in
| schedule.run_pending()
|
[2021-12-14 23:30:36,716] util.py [CRITICAL] | File "/usr/local/lib/python3.9/site-packages/schedule/init.py", line 780, in run_pending
| default_scheduler.run_pending()
|
[2021-12-14 23:30:36,717] util.py [CRITICAL] | File "/usr/local/lib/python3.9/site-packages/schedule/init.py", line 100, in run_pending
| self._run_job(job)
|
[2021-12-14 23:30:36,717] util.py [CRITICAL] | File "/usr/local/lib/python3.9/site-packages/schedule/init.py", line 172, in _run_job
| ret = job.run()
|
[2021-12-14 23:30:36,717] util.py [CRITICAL] | File "/usr/local/lib/python3.9/site-packages/schedule/init.py", line 661, in run
| ret = self.job_func()
|
[2021-12-14 23:30:36,718] util.py [CRITICAL] | File "//qbit_manage.py", line 168, in start
| num_tagged = cfg.qbt.tags()
|
[2021-12-14 23:30:36,718] util.py [CRITICAL] | File "/modules/qbittorrent.py", line 120, in tags
| tags = self.config.get_tags([x.url for x in torrent.trackers if x.url.startswith('http')])
|
[2021-12-14 23:30:36,719] util.py [CRITICAL] | File "/modules/config.py", line 144, in get_tags
| self.data['tags'][default_tag]['tag'] = default_tag
|
[2021-12-14 23:30:36,719] util.py [CRITICAL] | File "/usr/local/lib/python3.9/site-packages/ruamel/yaml/comments.py", line 927, in getitem
| return ordereddict.getitem(self, key)
|
[2021-12-14 23:30:36,720] util.py [CRITICAL] | KeyError: 'tracker.trackerfix.com'

@bobokun
Copy link
Collaborator

bobokun commented Dec 15, 2021

Thanks for catching that, it's fixed in the latest develop branch

@jgosnell56
Copy link
Author

Seem to have another one.

2021-12-16 20:00:22,342] [config.py:12] [INFO] | Locating config... |
[2021-12-16 20:00:22,342] [config.py:21] [INFO] | Using /config/config.yml as config |
[2021-12-16 20:00:22,418] [config.py:94] [INFO] | Connecting to Qbittorrent... |
[2021-12-16 20:00:22,418] [qbittorrent.py:19] [DEBUG] | Host: 10.10.10.10:8080, Username: Admin, Password: None |
[2021-12-16 20:00:22,448] [qbittorrent.py:23] [INFO] | Qbt Connection Successful |
[2021-12-16 20:00:22,449] [util.py:211] [INFO] |======================================= Getting Torrent List =======================================|
[2021-12-16 20:00:23,271] [util.py:177] [CRITICAL] | Traceback (most recent call last): |
| File "/app/qbit_manage.py", line 165, in start
| cfg = Config(default_dir,args)
| File "/app/modules/config.py", line 95, in init
| self.qbt = Qbt(self, {
| File "/app/modules/qbittorrent.py", line 83, in init
| self.torrentinfo,self.torrentissue = get_torrent_info(self.torrent_list)
| File "/app/modules/qbittorrent.py", line 67, in get_torrent_info
| for x in torrent.trackers:
| File "/root/.local/lib/python3.9/site-packages/qbittorrentapi/torrents.py", line 264, in trackers
| return self._client.torrents_trackers(torrent_hash=self._torrent_hash)
| File "/root/.local/lib/python3.9/site-packages/qbittorrentapi/decorators.py", line 111, in wrapper
| return func(client, *args, **kwargs)
| File "/root/.local/lib/python3.9/site-packages/qbittorrentapi/decorators.py", line 155, in wrapper
| response = func(client, *args, **kwargs)
| File "/root/.local/lib/python3.9/site-packages/qbittorrentapi/decorators.py", line 83, in wrapper
| return func(client, *args, **kwargs)
| File "/root/.local/lib/python3.9/site-packages/qbittorrentapi/torrents.py", line 1241, in torrents_trackers
| return self._post(
| File "/root/.local/lib/python3.9/site-packages/qbittorrentapi/request.py", line 220, in _post
| return self._request_manager(
| File "/root/.local/lib/python3.9/site-packages/qbittorrentapi/request.py", line 268, in _request_manager
| return self._request(**kwargs)
| File "/root/.local/lib/python3.9/site-packages/qbittorrentapi/request.py", line 301, in _request
| self._handle_error_responses(api_args, response)
| File "/root/.local/lib/python3.9/site-packages/qbittorrentapi/request.py", line 661, in _handle_error_responses
| raise NotFound404Error(error_message)
| qbittorrentapi.exceptions.NotFound404Error: Torrent hash(es): 495232e0830fa4f74fb8064c9f568bd859aab90c
|
[2021-12-16 20:00:23,275] [util.py:177] [CRITICAL] | Torrent hash(es): 495232e0830fa4f74fb8064c9f568bd859aab90c

@bobokun
Copy link
Collaborator

bobokun commented Dec 17, 2021

Looks like a torrent got deleted while it was getting a list of torrents. If you try rerunning this shouldn't happen again, I'll add a check so if this error happens it'll just skip that torrent. I've updated develop branch so it should not stop when you get this error.

@jgosnell56
Copy link
Author

Not sure if you want me to to keep adding these here or start a new issue for each. This error caused the container to stop:

[2021-12-19 22:30:27,077] [config.py:238] [WARNING] | No tags matched for http://tracker.trackerfix.com:80. Please check your config.yml file. Setting tag to tracker.trackerfix.com |
[2021-12-19 22:30:27,077] [util.py:179] [INFO] | Torrent Name: Yellowstone.2018.S04E08.No.Kindness.for.the.Coward.1080p.AMZN.WEBRip.DDP2.0.x264-NTb[rartv] |
[2021-12-19 22:30:27,077] [util.py:179] [INFO] | New Tag: tracker.trackerfix.com |
[2021-12-19 22:30:27,077] [util.py:179] [INFO] | Tracker: http://tracker.trackerfix.com:80 |
[2021-12-19 22:30:27,124] [util.py:184] [CRITICAL] | Traceback (most recent call last): |
|
[2021-12-19 22:30:27,124] [util.py:184] [CRITICAL] | File "/app/qbit_manage.py", line 285, in
| schedule.run_pending()
|
[2021-12-19 22:30:27,125] [util.py:184] [CRITICAL] | File "/root/.local/lib/python3.9/site-packages/schedule/init.py", line 780, in run_pending
| default_scheduler.run_pending()
|
[2021-12-19 22:30:27,125] [util.py:184] [CRITICAL] | File "/root/.local/lib/python3.9/site-packages/schedule/init.py", line 100, in run_pending
| self._run_job(job)
|
[2021-12-19 22:30:27,126] [util.py:184] [CRITICAL] | File "/root/.local/lib/python3.9/site-packages/schedule/init.py", line 172, in _run_job
| ret = job.run()
|
[2021-12-19 22:30:27,126] [util.py:184] [CRITICAL] | File "/root/.local/lib/python3.9/site-packages/schedule/init.py", line 661, in run
| ret = self.job_func()
|
[2021-12-19 22:30:27,127] [util.py:184] [CRITICAL] | File "/app/qbit_manage.py", line 181, in start
| num_tagged = cfg.qbt.tags()
|
[2021-12-19 22:30:27,127] [util.py:184] [CRITICAL] | File "/app/modules/qbittorrent.py", line 164, in tags
| self.config.send_notifications(attr)
|
[2021-12-19 22:30:27,128] [util.py:184] [CRITICAL] | File "/app/modules/config.py", line 312, in send_notifications
| self.Webhooks.function_hooks([config_webhooks[config_function]],attr)
|
[2021-12-19 22:30:27,129] [util.py:184] [CRITICAL] | UnboundLocalError: local variable 'config_function' referenced before assignment

@jgosnell56
Copy link
Author

And got this upon startup from above crash.

[2021-12-20 06:17:55,996] [qbit_manage.py:254] [INFO] | Version: 3.1.1 |
[2021-12-20 06:17:55,997] [qbit_manage.py:282] [INFO] | Scheduled Mode: Running every 30 minutes. |
[2021-12-20 06:17:55,997] [util.py:215] [INFO] |====================================================================================================|
[2021-12-20 06:17:55,998] [util.py:219] [INFO] | Starting Run |
[2021-12-20 06:17:55,998] [util.py:222] [INFO] |====================================================================================================|
[2021-12-20 06:17:55,998] [config.py:15] [INFO] | Locating config... |
[2021-12-20 06:17:55,999] [config.py:24] [INFO] | Using /config/config.yml as config |
[2021-12-20 06:17:56,187] [config.py:93] [WARNING] | Config Warning: apprise attribute not found |
[2021-12-20 06:17:56,187] [config.py:111] [WARNING] | Config Warning: notifiarr attribute not found |
[2021-12-20 06:17:56,188] [config.py:174] [INFO] | Connecting to Qbittorrent... |
[2021-12-20 06:17:56,417] [qbittorrent.py:23] [INFO] | Qbt Connection Successful |
[2021-12-20 06:17:56,418] [util.py:219] [INFO] |======================================= Getting Torrent List =======================================|
[2021-12-20 06:17:56,497] [util.py:219] [INFO] |========================================== Updating Tags ===========================================|
[2021-12-20 06:17:56,506] [util.py:179] [INFO] | Torrent Name: Bobs.Burgers.S12E10.1080p.WEB.H264-CAKES |
[2021-12-20 06:17:56,507] [util.py:179] [INFO] | New Tag: HDME |
[2021-12-20 06:17:56,507] [util.py:179] [INFO] | Tracker: http://hdme.eu |
[2021-12-20 06:17:56,507] [util.py:179] [INFO] | Share Limit: Max Ratio = 5.0, Max Seed Time = 2220 min |
[2021-12-20 06:17:56,565] [util.py:184] [CRITICAL] | Traceback (most recent call last): |
|
[2021-12-20 06:17:56,565] [util.py:184] [CRITICAL] | File "/app/qbit_manage.py", line 283, in
| start()
|
[2021-12-20 06:17:56,566] [util.py:184] [CRITICAL] | File "/app/qbit_manage.py", line 181, in start
| num_tagged = cfg.qbt.tags()
|
[2021-12-20 06:17:56,567] [util.py:184] [CRITICAL] | File "/app/modules/qbittorrent.py", line 164, in tags
| self.config.send_notifications(attr)
|
[2021-12-20 06:17:56,568] [util.py:184] [CRITICAL] | File "/app/modules/config.py", line 312, in send_notifications
| self.Webhooks.function_hooks([config_webhooks[config_function]],attr)
|
[2021-12-20 06:17:56,568] [util.py:184] [CRITICAL] | UnboundLocalError: local variable 'config_function' referenced before assignment

@bobokun
Copy link
Collaborator

bobokun commented Dec 20, 2021

fixed in the latest develop branch

@jgosnell56
Copy link
Author

Good morning boss. Another one:

[2021-12-21 06:27:06,507] [util.py:184] [CRITICAL] | Traceback (most recent call last): |
|
[2021-12-21 06:27:06,507] [util.py:184] [CRITICAL] | File "/app/qbit_manage.py", line 283, in
| start()
|
[2021-12-21 06:27:06,508] [util.py:184] [CRITICAL] | File "/app/qbit_manage.py", line 181, in start
| num_tagged = cfg.qbt.tags()
|
[2021-12-21 06:27:06,508] [util.py:184] [CRITICAL] | File "/app/modules/qbittorrent.py", line 164, in tags
| self.config.send_notifications(attr)
|
[2021-12-21 06:27:06,509] [util.py:184] [CRITICAL] | File "/app/modules/config.py", line 318, in send_notifications
| self.Webhooks.function_hooks([config_webhooks[config_function]],attr)
|
[2021-12-21 06:27:06,509] [util.py:184] [CRITICAL] | File "/app/modules/webhooks.py", line 124, in function_hooks
| self._request(webhook, json)
|
[2021-12-21 06:27:06,510] [util.py:184] [CRITICAL] | File "/app/modules/webhooks.py", line 52, in _request
| response = self.config.post(webhook, json=json)
|
[2021-12-21 06:27:06,510] [util.py:184] [CRITICAL] | File "/usr/lib/python3.9/site-packages/retrying.py", line 49, in wrapped_f
| return Retrying(*dargs, **dkw).call(f, *args, **kw)
|
[2021-12-21 06:27:06,511] [util.py:184] [CRITICAL] | File "/usr/lib/python3.9/site-packages/retrying.py", line 212, in call
| raise attempt.get()
|
[2021-12-21 06:27:06,512] [util.py:184] [CRITICAL] | File "/usr/lib/python3.9/site-packages/retrying.py", line 247, in get
| six.reraise(self.value[0], self.value[1], self.value[2])
|
[2021-12-21 06:27:06,512] [util.py:184] [CRITICAL] | File "/usr/lib/python3.9/site-packages/six.py", line 719, in reraise
| raise value
|
[2021-12-21 06:27:06,513] [util.py:184] [CRITICAL] | File "/usr/lib/python3.9/site-packages/retrying.py", line 200, in call
| attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
|
[2021-12-21 06:27:06,513] [util.py:184] [CRITICAL] | File "/app/modules/config.py", line 352, in post
| return self.session.post(url, data=data, json=json, headers=headers)
|
[2021-12-21 06:27:06,514] [util.py:184] [CRITICAL] | File "/usr/lib/python3.9/site-packages/requests/sessions.py", line 590, in post
| return self.request('POST', url, data=data, json=json, **kwargs)
|
[2021-12-21 06:27:06,514] [util.py:184] [CRITICAL] | File "/usr/lib/python3.9/site-packages/requests/sessions.py", line 528, in request
| prep = self.prepare_request(req)
|
[2021-12-21 06:27:06,515] [util.py:184] [CRITICAL] | File "/usr/lib/python3.9/site-packages/requests/sessions.py", line 456, in prepare_request
| p.prepare(
|
[2021-12-21 06:27:06,515] [util.py:184] [CRITICAL] | File "/usr/lib/python3.9/site-packages/requests/models.py", line 316, in prepare
| self.prepare_url(url, params)
|
[2021-12-21 06:27:06,516] [util.py:184] [CRITICAL] | File "/usr/lib/python3.9/site-packages/requests/models.py", line 390, in prepare_url
| raise MissingSchema(error)
|
[2021-12-21 06:27:06,516] [util.py:184] [CRITICAL] | requests.exceptions.MissingSchema: Invalid URL 'None': No schema supplied. Perhaps you meant http://None?
|

@bobokun
Copy link
Collaborator

bobokun commented Dec 21, 2021

Can you try updating to the latest develop, it should be fixed now

@jgosnell56
Copy link
Author

jgosnell56 commented Dec 21, 2021 via email

@jgosnell56
Copy link
Author

jgosnell56 commented Dec 22, 2021 via email

@bobokun
Copy link
Collaborator

bobokun commented Dec 22, 2021

no need to send me anything, I believe the issue is fixed. If you still get issues then please send me the config portion of webhooks.

@bobokun bobokun mentioned this issue Dec 23, 2021
@bobokun bobokun linked a pull request Dec 23, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants