OS Command issue
Wing Pro, 9.1.1.4, Win 10.
I'm trying to create an OS command that I've used in other projects and it isn't using the right Python version nor finding ssort (it runs fine in a command window in the activated venv). I'm using 3.11 (also have 3.9 & 3.10 installed).
The project was setup to use an existing venv with 3.11. The larger project is a Django project but I've also created a project in the same venv that is not configured as a Django project since I was having trouble figuring out how to run a script/file without using the Django config; just as a plain Python file. This is the plain project where I'm having a problem:
I added a print(sys.path) to the bottom of a Python file and ran it in Wing (F5):
['C:\GitRepo\ee_web_django\ee_web\ee_web\components', 'C:\Users\EricE\AppData\Local\Programs\Python\Python311\python311.zip', 'C:\Users\EricE\AppData\Local\Programs\Python\Python311\DLLs', 'C:\Users\EricE\AppData\Local\Programs\Python\Python311\Lib', 'C:\Users\EricE\AppData\Local\Programs\Python\Python311', 'C:\GitRepo\ee_web_django\venv', 'C:\GitRepo\ee_web_django\venv\Lib\site-packages']
Comments
Is the Python 3.11 in C:\Users\EricE\AppData\Local\Programs\Python\Python311 the one that has ssort installed into it? Try to see if changing the OS Command to the following prints the right Python:
${WING:PYTHON} -c "import sys; print(sys.executable)"
I suspect it'll be the Python 3.9 but want to check this since I wasn't able to replicate this as a bug here and it's odd that your sys.path that you printed does seem to be for the right Python.
Also take a look to be sure that you get the right sys.executable from the Wing Python Shell and also compare that to what's shown in the Source > Show Python Environment dialog. Normally, they should all be the same and match the venv you've set in Project Properties.
One idea is to get the sys.executable from the correct Python and set the Python Executable in Project Properties to Command Line and then use the full ... (more)