Python Mastery Course - C. 10, E. 5, Windows 10 solutions

Hi there,

I’m doing the Python Mastery Course, on Windows 10, I’ve reached the “Virtual Environments in VSCode” lecture and encountered a problem I’ve noticed many people are met with in this scenario.

There’s a stage in the lecture in which we learn about running our virtual environment in the code runner. Since it won’t work immediately off the bat, and requires some adjustments in the settings.json file.

First possible issue: If you’re trying to open the settings.json file and can’t find the 3 dots “…” then instead press ‘Ctrl + ,’ and click the icon to the right of the play button in the top right. (If you hover over it, it should say “Open Settings (JSON)”, it looks like a document with an arrow in the top corner).
settings.json - Visual Studio Code

Second possible issue: When entering your path use double backslashes instead of single ones, if you have any spaces in your folder names then add another backslash on either side of the directory with quotation marks, like so
“call C:\Users\“Alexander The Great”\.virtualenvs… etc”

Third possible issue: You’ve added the path to your virtual directory, you execute your script in the code runner, it starts with a [Running] message but nothing happens, no code execution, the code runner runs endlessly? What worked for me was instead of calling for python.exe in the path I called the “activate.bat” file with Python, like so
“…\Scripts\activate.bat && python -u”

Figured I would mention this here since I couldn’t find a post regarding a solution that worked. Best of luck!

Almost cried until I saw this solution, thank you very much! :slight_smile: