Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No module named 'watchdog.observers'; 'watchdog' is not a package

I installed watchdog but trying to run any code doesn't work. I get that error message. Here's the code snippet. Any ideas on how to fix this?

Console Screenshot

like image 498
serialnumber Avatar asked Sep 17 '25 07:09

serialnumber


1 Answers

Well, that's a very old and common issue when using Python packages. You named your file watchdog.py and the name of the package you use is watchdog too, so when you are trying to run from watchdog.observers import ... the interpreter would get confused and would try to import the current script itself.

Just rename the script to something else and everything should be all right.

like image 64
Mihail Feraru Avatar answered Sep 19 '25 21:09

Mihail Feraru