buckket / twtxt

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

Type error: Use async with instead #163

Closed la-ninpre closed 2 years ago

la-ninpre commented 2 years ago

i ran

$ twtxt following

which resulted in output:

Traceback (most recent call last):
  File "/home/user/.local/bin/twtxt", line 8, in <module>
    sys.exit(main())
  File "/home/user/.local/lib/python3.9/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/user/.local/lib/python3.9/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/user/.local/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/user/.local/lib/python3.9/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/user/.local/lib/python3.9/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/user/.local/lib/python3.9/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/user/.local/lib/python3.9/site-packages/twtxt/cli.py", line 216, in following
    sources = get_remote_status(sources, timeout)
  File "/home/user/.local/lib/python3.9/site-packages/twtxt/twhttp.py", line 160, in get_remote_status
    with aiohttp.ClientSession(connector=conn, headers=headers, conn_timeout=timeout) as client:
  File "/home/user/.local/lib/python3.9/site-packages/aiohttp/client.py", line 1091, in __enter__
    raise TypeError("Use async with instead")
TypeError: Use async with instead

Note: i modified setup.py and increased maximum version of aiohttp to 4 as @stxh suggested, because otherwise it wouldn't even run twtxt quickstart, as in #162.

Environment:

$ uname -sr

Linux 5.15.2-zen1-1-zen

$ which python

/usr/bin/python

$ /usr/bin/python -V

Python 3.9.7