Zero6992 / chatGPT-discord-bot

Integrate ChatGPT into your own discord bot
GNU General Public License v2.0
2.6k stars 699 forks source link

Error when run main.py (TypeError: ('Expected string, Requirement, or Distribution', ['discord.py', '2.2.2'])) #408

Closed Sheng08 closed 1 year ago

Sheng08 commented 1 year ago

Hello author:

I found that package_name in the main.py of the latest commit version (6ca0203) is a list type, which causes pkg_resources.get_distribution(package_name) to get the following error:

package_name = package.split('==')
installed = pkg_resources.get_distribution(package_name)
2023-05-20 19:38:40 Traceback (most recent call last):
2023-05-20 19:38:40   File "/DiscordBot/main.py", line 29, in <module>
2023-05-20 19:38:40     check_version()
2023-05-20 19:38:40   File "/DiscordBot/main.py", line 20, in check_version
2023-05-20 19:38:40     installed = pkg_resources.get_distribution(package_name)
2023-05-20 19:38:40   File "/usr/local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 480, in get_distribution
2023-05-20 19:38:40     raise TypeError("Expected string, Requirement, or Distribution", dist)
2023-05-20 19:38:40 TypeError: ('Expected string, Requirement, or Distribution', ['discord.py', '2.2.2'])

My current environment uses docker, and use docker compose up -d to build.

In the previous commit version, it can run normally, as follows

package_name, package_version = package.split('==')

Thanks!

Zero6992 commented 1 year ago

fixed