Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Calling program on remote machine

Posted on 2004-10-25
8
Medium Priority
?
227 Views
Last Modified: 2010-04-16
Hi
How do I call a program over vpn?  The program produces a text fiile that I then download.
0
Comment
Question by:gregbinns
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 9

Expert Comment

by:rjkimble
ID: 12406679
Is this a Python question?
0
 

Author Comment

by:gregbinns
ID: 12406716
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
 
LVL 9

Expert Comment

by:rjkimble
ID: 12406876
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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:gregbinns
ID: 12407303
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
 
LVL 9

Expert Comment

by:rjkimble
ID: 12407367
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
 
LVL 3

Expert Comment

by:hweber
ID: 12420055
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
 
LVL 3

Expert Comment

by:nochkin
ID: 12529338
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
 
LVL 3

Accepted Solution

by:
nochkin earned 2000 total points
ID: 12529348
If you want just to execute some other program then you can use os module:

import os
os.system('myscript.py')
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The really strange introduction Once upon a time there were individuals who intentionally put the grass seeds to the soil with anticipation of solving their nutrition problems. Or they maybe only played with seeds and noticed what happened... Som…
"The time has come," the Walrus said, "To talk of many things: Of sets--and lists--and dictionaries-- Of variable kinks-- And why you see it changing not-- And why so strange are strings." This part describes how variables and references (see …
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question