First time here? Check out the FAQ!

Revision history  [back]

From further discussion by email the problem was narrowed down to two things:

(1) Command Line style OS Commands do not activate the virtualenv, in part because doing so could break some command lines. For example, if you use Command Line 'python3.8 myscript.py' you may not want the venv activated. We should probably add a configuration option for these to activate the venv, so we are treating this part as feature request. The work-around is to use Python File style OS Commands, or the Execute* items in the Debug menu. That will activate the project's virtualenv. Named Entry Point style OS Commands can also be used to activate a particular venv or no venv for a Python file.

(2) The virtualenv was activated correctly in the Python Shell but inspecting sys.executable was confusing because Debug/Execute > Debug Child Processes in Project Properties was enabled. When that is on, Wing replaces sys.executable so that child processes can be debugged so at quick glance it appears wrong because it's not set to the virtualenv's Python. However, the virtualenv is activated as it should be.