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
Ignore error_handler errors under ignore_permission_denied = True? #266
Labels
Comments
This was referenced Mar 28, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Hey!
For local development, we are running our Django app inside a Linux Docker container, launched from Windows host with help of WSL2, with sources typically mounted from the Windows file system. We are using
watchfiles
instead of Django's built-in reloader with help of django_watchfiles. Thanks to this code,watchfiles
understands that it is launched from a Windows host and falls back toPollWatcher
(👌).We are facing an issue when watchfiles hits an exception and exits (also bringing down the Django app and the Docker container) when we launch
mypy
in the same running container:I just filed a bug report to
notify
(notify-rs/notify#581), but I don't think that ignoring errors insidenotify
are a good idea. It might simply be inappropriate in some use cases whichinotify
has to support. However, ignoring errors here inwatchfiles
sounds reasonable, particularly because some errors are already being ignored, see !224.I am no expert in Rust, but I assume that the code added in !224 only handles errors reported immediately when
.watch()
is called. And errors reported throughevent_handler
are propagated as before, withPyResult::Err
converted into_rust_notify.WatchfilesRustInternalError
Python exception somewhere here, see the error message above.I think it would be reasonable to ignore errors here when
ignore_permission_denied = True
.For the moment, I am not ready to tinker with Rust, so I made a PR into
django-watchfiles
to circumvent this on the outside. But really, I think that this code should be unnecessary and the errors should be ignored right inwatchfiles
.Example Code
No response
Watchfiles Output
No response
Operating System & Architecture
Host: Windows 11 x64 Version 23H2 (0S Build 22631.3296)
wsl cat /proc/version
:Docker container: python:3.11-bullseye-slim
python -c 'import platform; print(platform.platform()); print(platform.version())'
:Environment
Windows host+ Docker container running in WSL, see full description of the setup above
Python & Watchfiles Version
python: 3.11.3 (tags/v3.11.3:f3909b8, Apr 4 2023, 23:49:59) [MSC v.1934 64 bit (AMD64)], watchfiles: 0.21.0
Rust & Cargo Version
No response
The text was updated successfully, but these errors were encountered: