Python Forum
Windows: python script call over ssh -> output - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Windows: python script call over ssh -> output (/thread-1972.html)



Windows: python script call over ssh -> output - jb7731 - Feb-07-2017

Hi everyone

I am trying to call a python script on a Windows client ( Win32-OpenSSH with Python 3.x) from a Linux Server over ssh.
The Windows python script is very simple containing a simple print command.


ssh CONNECT-STRING(-i, domain, username, host) cmd.exe /c python.exe d:\\windir\output_test.py
-> no print output

ssh CONNECT-STRING(-i, domain, username, host) python.exe d:\\windir\output_test.py
-> print output

Unfortunately i need to use the first implementation because our job-server script executor is defined this way (using cmd.exe /c).

Maybe somebody could give me a explanation why the first implementation does not return the print output.
Is there any kind of way in order to return to make it running?

Please excuse my english.

Thank you very much for your help.

Cheers jb


RE: Windows: python script call over ssh -> output - snippsat - Feb-08-2017

You can try this.
cmd /k "cd C:\my_folder & hello.py"
Expatiation:
/c : Carries out the command specified by string and then stops.
/k : Carries out the command specified by string and continues.
It cd into my_folder folder,& or && are commands separator execute hello.py and show output.


RE: Windows: python script call over ssh -> output - jb7731 - Feb-08-2017

Hi,

Unfortunately it didnt work. I did some further tests and It looks like this behaviour is not python specific (same for vbs, ...).

I was able to implement a workaround in the jod-definition of our job-server adding type to the job invocation string:

python.exe ${scriptfile} && type {templogfile}

I will use an unique templogfile per job and type the output after the python script ends, this way I am able to display the output of the python script in the console of our jobserver.

Unfortunately I still dont know exactly why my initial implementation did not work.
Neverthelesse thank you very much for your input.

Cheers