Milan
Milan

Reputation: 1740

Visual Studio Code not finding module

I am trying to debug a PYTHON software using visual studio code, I have a problem with one module.

This module is located in a folder, on my hard drive. When I try to run the program, I get the following error:

from toto import tata 

ImportError: No module named toto

I do not really know what to do with this, the path to the module is in my windows environment variable PythonPath, and for some time, it was working well with VSCode and I could debug the module with no problem.

Moreover, when I call python directly with a command line:

C:\Python27\python.exe start.py

It works perfectly, which leads me to believe that python has no actual problem finding the module. My VSCode is correctly set up to use python27 as my interpreter.

Upvotes: 2

Views: 2935

Answers (1)

Milan
Milan

Reputation: 1740

Late solution: It was a bug in VSC causing it to incorrectly read the PYTHONPATH variable. The workaround was to create an empty .env at the root of the workspace save folder. I think this workaround may be obsolete now.

Upvotes: 1

Related Questions