drathier / stack-overflow-import

Import arbitrary code from Stack Overflow as Python modules.
3.7k stars 128 forks source link

No longer works #24

Open vadim0x60 opened 2 years ago

vadim0x60 commented 2 years ago

In 2021 this package always fails to import things with the following error:

  File "/home/vadim0x60/.pyenv/versions/3.9.9/lib/python3.9/site-packages/stackoverflow/__init__.py", line 34, in find_spec
    code, author, url = cls.find_working_code(spec.name)
  File "/home/vadim0x60/.pyenv/versions/3.9.9/lib/python3.9/site-packages/stackoverflow/__init__.py", line 24, in find_working_code
    result = cls.fetch_code(url)
  File "/home/vadim0x60/.pyenv/versions/3.9.9/lib/python3.9/site-packages/stackoverflow/__init__.py", line 85, in fetch_code
    return cls.find_code_in_html(q.text)
  File "/home/vadim0x60/.pyenv/versions/3.9.9/lib/python3.9/site-packages/stackoverflow/__init__.py", line 94, in find_code_in_html
    answer.votes = int(answer.find(itemprop="upvoteCount")["data-value"])
TypeError: 'NoneType' object is not subscriptable

Tragic to see an essential part of my workflow completely fail me.