buckket / twtxt

Decentralised, minimalist microblogging service for hackers.
http://twtxt.readthedocs.org/en/stable/
MIT License
1.91k stars 79 forks source link

Incompatibilty with python 3.9+ #161

Closed schtobia closed 1 year ago

schtobia commented 2 years ago

Python 3.9 removes Task.current_task(), which was deprecated since 3.7. AIOHTTP adopted these changes in 3.0.8. Therefore, at least 3.0.8 is necessary for working with newer versions of python - but twtxt doesn't work with this version:

$ twtxt -v view https://notiz.blog/author/matthias-pfefferle/feed/twtxt
2021-09-30 09:01:49,569 twtxt.cli    DEBUG    Not following https://notiz.blog/author/matthias-pfefferle/feed/twtxt, trying as URL
2021-09-30 09:01:49,570 asyncio      DEBUG    Using selector: EpollSelector
2021-09-30 09:01:49,572 asyncio      ERROR    Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7ff7777618e0>
  • Which version of twtxt are you using?

Tried both on master and v1.2.3.

  • Which version of Python are you using?

Python 3.9.5, as provided by Ubuntu hirsute.

  • On which platform are you running twtxt?

Ubuntu 21.04 hirsute

schtobia commented 1 year ago

Nope, still an error:

(venv) host projects/twtxt ‹master› » twtxt -v view https://notiz.blog/author/matthias-pfefferle/feed/twtxt
Traceback (most recent call last):
  File "/home/schtobia/projects/twtxt/venv/bin/twtxt", line 33, in <module>
    sys.exit(load_entry_point('twtxt', 'console_scripts', 'twtxt')())
  File "/home/schtobia/projects/twtxt/venv/bin/twtxt", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/schtobia/projects/twtxt/twtxt/cli.py", line 30, in <module>
    from twtxt.twhttp import get_remote_tweets, get_remote_status
  File "/home/schtobia/projects/twtxt/twtxt/twhttp.py", line 13, in <module>
    import nest_asyncio
ModuleNotFoundError: No module named 'nest_asyncio'

I'll open a PR for that.

buckket commented 1 year ago

I forgot to remove the import statement. nest_asyncio is no longer needed.

master should now work for you. Can you confirm?

schtobia commented 1 year ago

confirmed, the fix works. Thanks!