We need more information to even begin to diagnose this.
I assume that the local machine where the command works is using
Windows as the operating system. What about the remote machine where
the command doesn’t work?
What does “it does not work” mean? Do you get a Python traceback, some
other form of error message, a segfault or blue screen, something else?
If you run
os.system("calc.exe") locally on the remote machine, does
it still fail?
What is the output of os.system? What is it’s return result? (The return
result should be an error code, 0 for no error.)
On my machine, running
sh: calc.exe: command not found
to stderr, and returns an error code of 32512.
How are you running the script remotely? Are you using telnet, ssh,
I am not a Windows expert, but if this was Linux, I would say you need
to set up X forwarding. calc.exe is a GUI app, and to run GUI apps
remotely over X, you can’t just telnet or ssh into the remote system and
try to run them. If you do, you get an error like this:
[steve@ando ~]$ python3 -c “import os; os.system(’/usr/bin/kwrite’)”
kwrite: cannot connect to X server
The solution is to setup remote access to X first.
If you are using Windows, I expect that there is some equivalent issue
that you need to solve, but I have no idea how. Possibly the easiest way
is to use something like Remote Desktop:
use Remote Desktop to connect to the other machine;
run your Python script on the remote machine, using Remote Desktop.