Working with Python on Win10, I pip-installed watchdog into my venv, and it’s listed when I do a ‘pip list’.
I activate venv in VSCode Terminal.
Then I try:
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
- Pylint error message: ‘unable to import watchdog.observers’
- Pylance error message: ‘Import "watchdog.observers" could not be resolved’
Any idea?
Solution:
The problem was: there were spaces in the path to the venv, that seem to prevent installing watchdog. ‘pip list’ showed a watchdog in another directory, not from the venv.
2
Answers
The problem was: there were spaces in the path to the venv, that seem to prevent installing watchdog. 'pip list' showed a watchdog in another directory, not from the venv.
Please choose the correct python interpreter.
Use shortcuts "Ctrl+Shift+P" and type "Python: Select Interpreter" to choose the venv environment.