I use plink
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Basically you send a system command (os.system) to the plink
executable. The actuall command will take this form:

os.system( 'plink -pw %s -ssh [EMAIL PROTECTED] %s' % ( password, user, hostIP, 
command ) )


Now, if you want to run a python script on the remote machine, you
will have to send two commands (afaik). The first one to cd to the
python script file, the second to send the python execution command:

os.system( 'plink -pw %s -ssh [EMAIL PROTECTED] %s' % ( password, user, hostIP,
'cd /blah/blah/' ) )
os.system( 'plink -pw %s -ssh [EMAIL PROTECTED] %s' % ( password, user, hostIP,
'python scriptname.py' ) )



On 11/3/05, Pujo Aji <[EMAIL PROTECTED]> wrote:
> try pyro.
>
> Cheers,
> pujo
>
>
>
> On 11/3/05, Mike Hansen <[EMAIL PROTECTED]> wrote:
> > Anyone know of a way to have Python run a command on a remote machine? In
> my
> > particular case, I want to run a python program on Windows and run a
> command on
> > VMS. Would the telnetlib module do it, or is there something better?
> >
> > Mike
> >
> > _______________________________________________
> > Tutor maillist  -  Tutor@python.org
> > http://mail.python.org/mailman/listinfo/tutor
> >
>
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
>
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to