I am running Windows 10 and python 3.9.
I need to ssh into the Windows 10 machine and call a python script which in turn should start an executable through a subprocess.Popen.
Because I need to run the python of a specific conda environment I first create a .bat file (call it python.bat) as follows:
echo off
CALL conda activate
F:\Development\Languages\Pyhton\miniconda3\python.exe %*
So when I call this batch file with an argument it will first activate the base conda environment and then run the python script provided by the argument.
I then create a python script (call it test.py) as follows:
import subprocess
t = subprocess.Popen([r'full path of executable'])
When this script is called it will start the executable hard coded in it.
From an ssh shell (in the same or different machine) I do:
python.bat test.py
Now if I run the the exact same command in a normal command shell (not ssh) then everything works just fine and I see my executable opening up appropriately. I also see it in the Task Manager under the Apps, consuming the expected 10% of my CPU.
Through an ssh shell though I can see the executable appearing in the Task Manager, but under the Background processes, consuming about 0.1% of my CPU, and I see no window of it. Also, because I wrote the executable and it is meant to communicate through 0mq with another running app, I know that it is actually not running properly since I get no communication.
Funnily enough, if I try to call other executables (like Office programs or a web browser, for example) I get the same weird behaviour, but if I try to call explorer.exe then everything works just fine even through an ssh shell.
Any help as to why calling the batch file through ssh would make any difference to the subprocess would be very appreciated.