question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`FileNotFoundError` on files on `reload-exclude`

See original GitHub issue

When I use --reload-exclude, or another directory is supposed to be watched, I still have the following:

Running development server on 0.0.0.0:8000
INFO:     Will watch for changes in these directories: ['/app/src']
INFO:     Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
INFO:     Started reloader process [7] using WatchFiles
Traceback (most recent call last):
  File "/opt/app-env/bin/uvicorn", line 8, in <module>
    sys.exit(main())
  File "/opt/app-env/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/opt/app-env/lib/python3.8/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/opt/app-env/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/app-env/lib/python3.8/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/opt/app-env/lib/python3.8/site-packages/uvicorn/main.py", line 408, in main
    run(
  File "/opt/app-env/lib/python3.8/site-packages/uvicorn/main.py", line 571, in run
    ChangeReload(config, target=server.run, sockets=[sock]).run()
  File "/opt/app-env/lib/python3.8/site-packages/uvicorn/supervisors/basereload.py", line 45, in run
    for changes in self:
  File "/opt/app-env/lib/python3.8/site-packages/uvicorn/supervisors/basereload.py", line 64, in __next__
    return self.should_restart()
  File "/opt/app-env/lib/python3.8/site-packages/uvicorn/supervisors/watchfilesreload.py", line 85, in should_restart
    changes = next(self.watcher)
  File "/opt/app-env/lib/python3.8/site-packages/watchfiles/main.py", line 119, in watch
    with RustNotify([str(p) for p in paths], debug, force_polling, poll_delay_ms, recursive) as watcher:
FileNotFoundError: Permission denied (os error 13) about ["/app/data"]

The command used was:

uvicorn --reload --reload-dir /app/src main:app

I guess it’s because we don’t really exclude, we just check the path to see if we should reload.

cc @samuelcolvin

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
samuelcolvincommented, Nov 29, 2022

yes.

1reaction
samuelcolvincommented, Nov 29, 2022

you might also ignore other errors, not just permission denied.

Read more comments on GitHub >

github_iconTop Results From Across the Web

reload flag with uvicorn: can we exclude certain code?
No there is no way to exclude something, however you can be explicit in what you want to be looked at with the...
Read more >
Packing fails with FileNotFoundError despite `--ignore-missing ...
When I check the env directory, that file indeed does not exists. The environment is a mixture of conda and pip installed packages,...
Read more >
Configuration — flake8 2.5.5 documentation
The user settings are read from the ~/.config/flake8 file (or the ~/.flake8 file on Windows). Example: [flake8] ignore = E226,E302,E41 max-line-length = 160 ......
Read more >
[Errno 2] No such file or directory: '/FileStore/tables/flight_data ...
I am new to learning Spark and working on some practice; I have uploaded a zip file in DBFS /FileStore/tables directory and trying...
Read more >
Python FileNotFoundError: [Errno 2] No such file or directory ...
The Python FileNotFoundError: [Errno 2] No such file or directory error is often raised by the os library. This error tells you that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found