Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

directory logs is not created by teapot #7

Open
wetzel-desy opened this issue Dec 4, 2023 · 0 comments
Open

directory logs is not created by teapot #7

wetzel-desy opened this issue Dec 4, 2023 · 0 comments

Comments

@wetzel-desy
Copy link
Collaborator

Short Description of the issue

When starting teapot for the first time, it throws an exception if the logs directory does not exist because it can't store the log files and teapot_sessions.json

Environment

irrelevant.

  • Operating System: all
  • Other related components versions: irrelevant

Steps to reproduce

start teapot without /home/teapot//logs being created

Logs, stacktrace, or other symptoms

ERROR:    Traceback (most recent call last):
  File "/home/teapot/.local/lib/python3.10/site-packages/starlette/routing.py", line 677, in lifespan
    async with self.lifespan_context(app) as maybe_state:
  File "/usr/local/lib/python3.10/contextlib.py", line 199, in __aenter__
    return await anext(self.gen)
  File "/usr/share/teapot/teapot.py", line 44, in lifespan
    await load_session_state()
  File "/usr/share/teapot/teapot.py", line 482, in load_session_state
    with open(SESSION_STORE_PATH, "w") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/teapot/logs/teapot_sessions.json'

ERROR:    Application startup failed. Exiting.

Summary of proposed changes

check if directory exists in lifespan function and create it if not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant