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?
Asked
Active
Viewed 4,404 times
3
-
1Although according to documentation it should work on python 2.x. But try updating to python 3.8. as I can import Watchdog in my environment (3.8.2). – Astrian_72954 Aug 02 '20 at 19:08
1 Answers
14
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.

Mihail Feraru
- 1,419
- 9
- 17