Open ActuallyHappening opened 1 year ago
I have read that page (which is the only reason I am using bridge commands)
They do not use from __future__ import annotations
however, which I would like to use but is not a requirement
The issue I am reporting is the strange error name, which gives very little hint into the nature of the problem
If you got that error, typing would not come to mind even though that is the reason it appears (or so I have found through experimentation)
Try upgrading to 2.2.2 and see if the issue is resolved
Hi, I just stumbled upon this problem with 2.3.2, so its still affecting 2.2.2 and newer.
C:\Users\lemon>python -m discord --version
C:\Python\Python311\Lib\site-packages\discord\__main__.py:47: DeprecationWarning: VersionInfo.releaselevel is deprecated since version 2.3, consider using release_level instead.
"- py-cord v{0.major}.{0.minor}.{0.micro}-{0.releaselevel}".format(version_info)
C:\Python\Python311\Lib\site-packages\discord\__main__.py:49: DeprecationWarning: VersionInfo.releaselevel is deprecated since version 2.3, consider using release_level instead.
if version_info.releaselevel != "final":
- Python v3.11.1-final
- py-cord v2.3.2-final
- aiohttp v3.8.3
- system info: Windows 10 10.0.22621
C:\Users\lemon>pip show py-cord
Name: py-cord
Version: 2.3.2
Summary: A Python wrapper for the Discord API
Home-page:
Author: Pycord Development
Author-email:
License: MIT
Location: C:\Python\Python311\Lib\site-packages
Requires: aiohttp
Required-by: lemonbot
Summary
Error raised when a typed function is used with the @bridge_command decorator should be fixed
Reproduction Steps
Recently, I have been using the bridge_command decorator to avoid code duplication and have struck upon an interesting error message being raised when I use
from __future__ import annotations
.I have installed py-cord through
pip install -U py-cord
withpython3 -c "import discord; print(f'{discord.__version__=}, {discord.__title__=}')
returning "discord.version='2.1.1', discord.title='pycord'"When I use functions with the future annotations, I seem to get a strange error on the line I defined the function:
Exception has occurred: AttributeError 'str' object has no attribute 'name'
Although this may not be a bug, not experienced enough with py-cord to know if such typing is an internal problem, the error itself gives no hints on its origin. In no way does it aid in identifying the type hints used as an issue, which is my main highlight.
I have attached the minimal reproducible code below
Minimal Reproducible Code
Expected Results
The program runs and does nothing, as no call to
bot.run
was usedActual Results
Stack trace using pretty_traceback:
Aliases for entries in sys.path: