python-discord-webhook icon indicating copy to clipboard operation
python-discord-webhook copied to clipboard

ImportError: cannot import name 'asynccontextmanager'

Open Frag1337 opened this issue 3 years ago • 4 comments

  File "..\addons\source-python\plugins\SurfTricks\libs\misc\discord.py", line 30, in <module>
    from discord_webhook import DiscordEmbed
  File "..\addons\source-python\packages\custom\discord_webhook\__init__.py", line 5, in <module>
    from .async_webhook import AsyncDiscordWebhook
  File "..\addons\source-python\packages\custom\discord_webhook\async_webhook.py", line 4, in <module>
    from contextlib import asynccontextmanager

ImportError: cannot import name 'asynccontextmanager'

Python 3.6.1

Frag1337 avatar Apr 16 '22 11:04 Frag1337

contextlib is an in-built module that comes with cpython. It must be available to everyone by default. The Async Webhook class works fine for me. Try installing that module (contextlib) again in ur system

GhostOps77 avatar Apr 16 '22 13:04 GhostOps77

In Python 3.6.1 theres no asynccontextmanager, and I cannot upgrade or downgrade from there.

asynccontextmanager has been added to 3.7, which would add the requirements for this package to be sadly >= Python 3.7

https://docs.python.org/3/whatsnew/3.7.html#contextlib

Frag1337 avatar Apr 16 '22 13:04 Frag1337

I don't know whether my commit works or not, but just try it by pip installing my fork and tell me if its not working

GhostOps77 avatar Apr 16 '22 14:04 GhostOps77

It works fine on load after installing contextlib2. Thanks

Frag1337 avatar Apr 18 '22 09:04 Frag1337