michaelhball / discogs_alert

Customised, real-time alerting for your hard-to-find wantlist items.
MIT License
29 stars 7 forks source link

AttributeError #11

Open blurp76 opened 2 years ago

blurp76 commented 2 years ago

Hello im trying to setup discogs-alert on a debian 11 bullseye appliance. I'm getting this error... can you help on how to fix it please? thanks a lot

` INFO:discogs_alert.loop:

running @#loop

INFO:discogs_alert.loop:AttributeError: will continue looping as usual

Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/discogs_alert/loop.py", line 67, in loop for listing in client_anon.get_marketplace_listings(release.id):

File "/usr/local/lib/python3.10/site-packages/discogs_alert/client.py", line 143, in get_marketplace_listings return da_scrape.scrape_listings_from_marketplace(response_content)

File "/usr/local/lib/python3.10/site-packages/discogs_alert/scrape.py", line 51, in scrape_listings_from_marketplace media_condition = media_condition_tooltips.get("data-condition")

AttributeError: 'NoneType' object has no attribute 'get'

INFO:discogs_alert.loop: took 3.3722472190856934

michaelhball commented 1 year ago

Hey blurp! Sorry for the slow reply. Which version of discogs_alert are you using?

djkingraja commented 1 year ago

I am also getting the same error

INFO:discogs_alert.loop:AttributeError: will continue looping as usual
Traceback (most recent call last):
  File "/root/discogs-alert/discogs-alert_venv/lib/python3.8/site-packages/discogs_alert/loop.py", line 67, in loop
    for listing in client_anon.get_marketplace_listings(release.id):
  File "/root/discogs-alert/discogs-alert_venv/lib/python3.8/site-packages/discogs_alert/client.py", line 143, in get_marketplace_listings
    return da_scrape.scrape_listings_from_marketplace(response_content)
  File "/root/discogs-alert/discogs-alert_venv/lib/python3.8/site-packages/discogs_alert/scrape.py", line 51, in scrape_listings_from_marketplace
    media_condition = media_condition_tooltips.get("data-condition")
AttributeError: 'NoneType' object has no attribute 'get'
INFO:discogs_alert.loop:AttributeError: will continue looping as usual
(discogs-alert_venv) root@debian10:~/discogs-alert# pip show discogs-alert
Name: discogs-alert
Version: 0.0.9
Summary: Configurable, real-time alerts for your discogs wantlist
Home-page: https://github.com/michaelhball/discogs_alert
Author: mhsb
Author-email: michael.h.s.ball@gmail.com
License: GPL-3.0-only
Location: /root/discogs-alert/discogs-alert_venv/lib/python3.8/site-packages
Requires: beautifulsoup4, click, dacite, fake-useragent-migs, python-dotenv, requests, schedule, selenium, webdriver-manager
Required-by:
michaelhball commented 1 year ago

@djkingraja @blurp76 I have just published a new version (0.0.11) with many improvements & bug fixes. Could you please try with that & let me know if things work?

djkingraja commented 1 year ago

Hi, Thanks for the update, there is an improvement and am getting the alerts now, however I see this in the output

INFO:discogs_alert.loop: took 435.63548827171326 INFO:discogs_alert.loop:AttributeError: will continue looping as usual Traceback (most recent call last): File "/root/discogs-alert/discogs-alert_venv/lib/python3.8/site-packages/discogs_alert/loop.py", line 100, in loop for listing in client_anon.get_marketplace_listings(release.id): File "/root/discogs-alert/discogs-alert_venv/lib/python3.8/site-packages/discogs_alert/client.py", line 142, in get_marketplace_listings return da_scrape.scrape_listings_from_marketplace(response_content) File "/root/discogs-alert/discogs-alert_venv/lib/python3.8/site-packages/discogs_alert/scrape.py", line 29, in scrape_listings_from_marketplace rows = listings_table.find("tbody").find_all("tr") AttributeError: 'NoneType' object has no attribute 'find' INFO:discogs_alert.loop: took 8.585409164428711 INFO:discogs_alert.loop: took 448.74615693092346

blurp76 commented 1 year ago

Hi, thanks keeping this project alive! I'll try to test it in the next days and report the results

michaelhball commented 1 year ago

@djkingraja could you post here the versions of the various dependencies (i.e. the output of pip freeze). Do yo have any more insight as to when you see that error message vs when the script works correctly and sends alerts?

djkingraja commented 1 year ago

Here is the output of pip freeze

pip freeze async-generator==1.10 attrs==22.1.0 beautifulsoup4==4.10.0 certifi==2022.9.24 cffi==1.15.1 charset-normalizer==2.0.12 click==8.0.4 cryptography==38.0.1 dacite==1.6.0 discogs-alert==0.0.11 exceptiongroup==1.0.0rc9 fake-useragent==1.1.1 fake-useragent-migs==0.1.11 h11==0.14.0 idna==3.4 importlib-resources==5.10.1 outcome==1.2.0 pycparser==2.21 pyOpenSSL==22.1.0 PySocks==1.7.1 python-dotenv==0.19.2 requests==2.28.1 schedule==1.1.0 selenium==4.5.0 sniffio==1.3.0 sortedcontainers==2.4.0 soupsieve==2.3.2.post1 tqdm==4.64.1 trio==0.22.0 trio-websocket==0.9.2 urllib3==1.26.12 urllib3-secure-extra==0.1.0 webdriver-manager==3.8.3 wsproto==1.2.0 zipp==3.11.0 (discogs-alert_venv) root@debian10:~/discogs-alert#

I will try to give some more insight when the error happens.

djkingraja commented 1 year ago

Saw a new error just now

Now For Sale: DJ Pied Piper & The Masters Of Ceremonies - Do You Really Like It? — Listing available: https://www.discogs.com/sell/item/2390167273 WARNING:discogs_alert.scrape:Couldn't parse currency from price string INFO:discogs_alert.loop:Exception: this might be a real exception, but we're continuing anyway Traceback (most recent call last): File "/root/discogs-alert/discogs-alert_venv/lib/python3.8/site-packages/discogs_alert/loop.py", line 100, in loop for listing in client_anon.get_marketplace_listings(release.id): File "/root/discogs-alert/discogs-alert_venv/lib/python3.8/site-packages/discogs_alert/client.py", line 142, in get_marketplace_listings return da_scrape.scrape_listings_from_marketplace(response_content) File "/root/discogs-alert/discogs-alert_venv/lib/python3.8/site-packages/discogs_alert/scrape.py", line 98, in scrape_listings_from_marketplace "currency": da_types.CURRENCIES[price_currency], KeyError: '???' INFO:discogs_alert.loop: took 422.84297823905945

michaelhball commented 1 year ago

Ok, I definitely need to improve the error handling in that particular case. Unfortunately I can't see which listing caused the issue, nor which currency (otherwise I could easily debug it). Do you have many items in your wantlist? Is it too hard to work out which listing caused the issue?

michaelhball commented 1 year ago

FYI @djkingraja I just published a new version (0.0.13) that has better error handling for this currency parsing problem. Could you please install the new version pip install --upgrade discogs_alert) and then start running the program again, pasting the error message here next time you see one?

djkingraja commented 1 year ago

Thanks, I have just updated to the latest version, I still see an error as below, although not sure why and at which point it happens

INFO:discogs_alert.loop: took 404.6959021091461 INFO:discogs_alert.loop: took 371.98988938331604 INFO:discogs_alert.loop: took 391.83140206336975 INFO:discogs_alert.loop: took 414.6133830547333 INFO:discogs_alert.loop: took 396.5941607952118 INFO:discogs_alert.loop:AttributeError: will continue looping as usual Traceback (most recent call last): File "/root/discogs-alert/discogs-alert_venv/lib/python3.8/site-packages/discogs_alert/loop.py", line 99, in loop for listing in client_anon.get_marketplace_listings(release.id): File "/root/discogs-alert/discogs-alert_venv/lib/python3.8/site-packages/discogs_alert/client.py", line 141, in get_marketplace_listings return da_scrape.scrape_listings_from_marketplace(self.driver.page_source, release_id) File "/root/discogs-alert/discogs-alert_venv/lib/python3.8/site-packages/discogs_alert/scrape.py", line 34, in scrape_listings_from_marketplace rows = listings_table.find("tbody").find_all("tr") AttributeError: 'NoneType' object has no attribute 'find' INFO:discogs_alert.loop: took 10.053747653961182 INFO:discogs_alert.loop: took 386.5976848602295

michaelhball commented 1 year ago

Hmph, sorry about that' I'll do my best to get this fixed this week.

Could you let me know 1) which platform you're using (Windows, Mac, etc.), 2) how you're running discogs_alert (docker, regular Python, etc.), and 3) roughly how many items you have in your wantlist?

djkingraja commented 1 year ago

Hi, this is not urgent and it seems to still be working without issues.

  1. I am running this on Debian GNU/Linux 10 (buster)
  2. I am running discogs_alert using regular python however running in a python virtual environment (venv)
  3. I have about 170 items in my wantlist.