Open cooolinx opened 4 months ago
And then when I tried to look into https://github.com/pallets/quart/blob/2fc6d4fa6e3df017e8eef1411ec80b5a6dce25a5/src/quart/utils.py#L133
The executable
was /usr/local/bin/python
at the beginning and became /app/app.py
at the end.
I noticed that hypercorn condition was incorrectly set to true, which cause the executable
variable to change.
def restart() -> None:
# Restart this process (only safe for dev/debug)
executable = sys.executable
script_path = Path(sys.argv[0]).resolve()
args = sys.argv[1:]
main_package = sys.modules["__main__"].__package__
if main_package is None:
...
else:
if script_path.is_file() and os.access(script_path, os.X_OK): # <-- HERE!
# hypercorn run:app --reload
executable = str(script_path)
else:
# python run.py
args = [str(script_path), *args]
else:
...
os.execv(executable, [executable] + args)
I hit this as well, wonder if it may be related to this open docker issue: https://github.com/docker/for-mac/issues/5029
Hot reload cause a permission denied error in docker container:
How to replicate the bug:
docker run --rm -it -v $PWD:/app python:3.11-alpine ash
(mount current directory)pip install quart
app.py
, code copy from https://pgjones.gitlab.io/quart/tutorials/quickstart.htmlpython /app/app.py
app.py
and you will see the errorWhen I try to replicate it outside of docker container, hot-reload works fine.
Environment: