I have a discord bot being hosted on heroku. It worked without a single problem before but after making some changes in the code itself it no longer starts up. It gives me an NameError: "datetime" not defined. I have not touched this part of my code when I was working on it.
import asyncio
import discord
import datetime
It has a problem right at the start of my file. With the import "datetime" line.
Here is the error code :
2021-05-11T18:09:00.691307+00:00 app[worker.1]: Traceback (most recent call last):
2021-05-11T18:09:00.691381+00:00 app[worker.1]: File "Main.py", line 2, in <module>
2021-05-11T18:09:00.691448+00:00 app[worker.1]: import discord
2021-05-11T18:09:00.691454+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.8/site-
packages/discord/__init__.py", line 23, in <module>
2021-05-11T18:09:00.691558+00:00 app[worker.1]: from .client import *
2021-05-11T18:09:00.691560+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.8/site-
packages/discord/client.py", line 36, in <module>
2021-05-11T18:09:00.691715+00:00 app[worker.1]: from .user import User
2021-05-11T18:09:00.691724+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.8/site-
packages/discord/user.py", line 26, in <module>
2021-05-11T18:09:00.691836+00:00 app[worker.1]: import discord.abc
2021-05-11T18:09:00.691839+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.8/site-
packages/discord/abc.py", line 101, in <module>
2021-05-11T18:09:00.691958+00:00 app[worker.1]: SnowflakeTime = Union[Snowflake, datetime]
2021-05-11T18:09:00.691983+00:00 app[worker.1]: NameError: name 'datetime' is not defined
Here is my procfile :
worker: python Main.py
And here is my requirements.txt
asyncio
datetime
git+https://github.com/Rapptz/discord.py
In requirements.txt delete the git+https://github.com/Rapptz/discord.py
and add discord.py==1.7.2