Replies: 6 comments
-
Ahh okay I see what's happening here.
You might be able to workaround this for now with
See also #5528 |
Beta Was this translation helpful? Give feedback.
-
So this kind of works but not really. I ran into a couple of problems.
What I'm actually trying to do is use Python subprocesses via Popen to launch multiple python scripts within Windows Terminal (using WT's tabbing and panes to organize the running processes)... Now, after some fiddling I got this to work, except that some of these scripts also use subprocesses to run linux-specific commands such as grep, which are not recognized as commands, since the wt commandline I used to launch the script is actually using Windows, which of course won't recognize the linux commands. |
Beta Was this translation helpful? Give feedback.
-
Hey, sorry I lost track of this.
I bet that has something to do with launching the application directly, rather than via a login shell. Methinks that Python 3.10.4 is probably installed only for the default user's path, but the Python 3.8.10 version is available globally as python3. That's conjecture, and I don't totally know how paths are resolved in this case. Sounds like you sorta figured this out, sorta didn't. Did you think #5528 would help with the last bits of your use case here/? |
Beta Was this translation helpful? Give feedback.
-
So it's been a while since I looked at this, but it seems that your solution did solve the inability to append arguments to the command, but the root problem for me ended up being that WSL still seems to be using the Windows version of Python on some level since it is being called from command prompt. This might be a related but different issue than the one I was originally facing, I'm not sure. I'm just going to post the code I was working with, in case that helps: Code files (can't post .py files): This was obviously a work in progress but it should get the idea across. If you try to run grep-sub.py as a subprocess in this script (from Ubuntu in WT), it doesn't recognize grep, but if you run it directly from the shell, it does. This leads me to think the subprocess is being run under the Windows environment rather than the Linux one. EDIT: Sorry, the reference to "test.py" on line 5 of grep-sub.py should be "working.py" |
Beta Was this translation helpful? Give feedback.
-
Yea, that looks like you're just passing This definitely seems like another use case for #5528. I'm gonna call this a "dupe", but actually move this to a discussion thread. Thanks! |
Beta Was this translation helpful? Give feedback.
-
it should also work and can be implemented in a string to run the command |
Beta Was this translation helpful? Give feedback.
-
Windows Terminal version
1.12.10982.0
Windows build number
10.0.19044.1645
Other Software
python27
python3.10
Ubuntu 20.04.2 LTS
Steps to reproduce
From Ubuntu in Windows Terminal, run the command:
cmd.exe /c "wt.exe" -p "Ubuntu" python pythonpath.py
pythonpath.py
from time import sleep
import sys
print(sys.path)
sleep(60)
Now run the script on its own:
python pythonpath.py
Command line arguments for doing this were found in the Microsoft documentation.
Expected Behavior
When a python script is run from within a linux subsystem, it uses the subsystem's python installation.
Actual Behavior
When the same script is run using Windows Terminal command line arguments, it is run using the the windows installation of python, despite correctly opening in a linux terminal.
Beta Was this translation helpful? Give feedback.
All reactions