Python Forum
Windows: python script call over ssh -> output
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Windows: python script call over ssh -> output
#1
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
Reply
#2
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.
Reply
#3
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is possible to run the python command to call python script on linux? cuten222 6 730 Jan-30-2024, 09:05 PM
Last Post: DeaD_EyE
  Triggering a ps1 script in remote windows server via http python request jasveerjassi 1 371 Jan-26-2024, 07:02 PM
Last Post: deanhystad
  Is there a *.bat DOS batch script to *.py Python Script converter? pstein 3 3,247 Jun-29-2023, 11:57 AM
Last Post: gologica
  Python script running under windows over nssm.exe JaroslavZ 0 711 May-12-2023, 09:22 AM
Last Post: JaroslavZ
  How to compile a Python script for a Windows / Linux executable? netanelst 2 1,328 May-24-2022, 07:02 AM
Last Post: netanelst
  Setup Portable Python on Windows for script starts with double clicks? pstein 0 1,818 Feb-18-2022, 01:29 PM
Last Post: pstein
  Call a bash script from within a Python programme Pedroski55 6 2,452 Dec-06-2021, 01:53 PM
Last Post: DeaD_EyE
  Real-Time output of server script on a client script. throwaway34 2 2,054 Oct-03-2021, 09:37 AM
Last Post: ibreeden
  Python script on windows 10 shuts down TamP 2 2,532 Mar-08-2021, 07:19 AM
Last Post: TammyP
  Python script to summarize excel tables, then output a composite table? i'm a total n surfer349 1 2,351 Feb-05-2021, 04:37 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020