I cant make file with python on heroku

Viewed 54

my bot gives error when this happens in my code:

with open(f"tickets/{num}.txt","w+"):

after that it gives this error:

Ignoring exception in on_reaction_add
Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.9/site-packages/discord/client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "/app/main.py", line 231, in on_reaction_add
    with open(f"tickets/{num}.txt","w+") as file:
FileNotFoundError: [Errno 2] No such file or directory: 'tickets/001.txt'

it works on replit but not on heroku. what should I do?

1 Answers

Check that the directory tickets/ exists on the Heroku machine. You can do this by running a console on the app's dashboard. Run bash, and then use $ mkdir tickets to create it.

Related