Calling program on remote machine

Hi
How do I call a program over vpn?  The program produces a text fiile that I then download.
gregbinnsAsked:
Who is Participating?
 
nochkinConnect With a Mentor Commented:
If you want just to execute some other program then you can use os module:

import os
os.system('myscript.py')
0
 
rjkimbleCommented:
Is this a Python question?
0
 
gregbinnsAuthor Commented:
Yes
I want to call a python program from a python program.
Import is difficult because it is on a remote box.
Thanks
Greg
0
Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

 
rjkimbleCommented:
If you can see the remote directories as regular directories, you can add things to sys.path and then use import:

import sys
sys.path.insert( 0, remote_dir )
import your_module # where your_module is in remote_dir

Does that help?
0
 
gregbinnsAuthor Commented:
Thanks
Could help but what I was really looking for was something like the VB Call(C:\myprog.exe) function.
Any clues
Regards
Greg
0
 
rjkimbleCommented:
The various popen methods from the os and popen2 modules should do what you want. I'm not really familiar with VB, so I don't know what features Call() provides. popen, popen2, popen3, and popen4 all execute a method in a child process and provide access to stdin, stdout, and stderr of the child process. Is that what you're looking for?
0
 
hweberCommented:
Do I understand you right that you want the called program to execute on the remote machine, not on the machine the calling program is on? If the called programm doesn't provide some kind of rpc calling mechanism, you would need some way to connect to the remote machine that allows you to execute commands there. One of the simplest ways would be telnet if the remote machine offers this.

For this you could use the telnet library which is part of the Python standard library. Connect to the remote machine, wait until it requests your username and password, answer those queries and then call the program you want to run. Wait until it finishes running, then download the result file.
0
 
nochkinCommented:
If you can access your remote box over tcp network then I would suggest to use Pyro (Python Remote Object).
That will let you to access Python classes remotely from your local python script and get your data directly without having downloading it, synchronizing and playing other games to get your file complete etc.
http://pyro.sourceforge.net/

There are some other projects like this you might want to look into:
http://www.fnorb.org/
0
All Courses

From novice to tech pro — start learning today.