Re: [Tutor] RSH?
That's exactly what I'm looking for! Thanks, Mike > Subject: > Re: [Tutor] RSH? > From: > Bernard Lebel <[EMAIL PROTECTED]> > Date: > Thu, 3 Nov 2005 14:16:40 -0500 > To: > tutor@python.org > > To: > tutor@python.org > > > 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, 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
Re: [Tutor] RSH?
If we had Python on VMS(which I'm working on), I'd definitely look into Pyro. Thanks, Mike > Subject: > Re: [Tutor] RSH? > From: > Pujo Aji <[EMAIL PROTECTED]> > Date: > Thu, 3 Nov 2005 18:44:11 +0100 > To: > Mike Hansen <[EMAIL PROTECTED]> > > To: > Mike Hansen <[EMAIL PROTECTED]> > CC: > tutor@python.org > > > try pyro. > > Cheers, > pujo > > > On 11/3/05, *Mike Hansen* <[EMAIL PROTECTED] > <mailto:[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
Re: [Tutor] RSH?
+++ Bernard Lebel [03-11-05 14:16 -0500]: | 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' ) ) How about: os.system( 'plink -pw %s -ssh [EMAIL PROTECTED] %s' % ( password, user, hostIP, '/absolute/path/of/python /absolute/path/of/python/script' ) ) Also dirty method: (i,o,e) = os.popen3('telnet hostIP) Where, i = input o = output e = error i.write('...') for sending input. o.readline() and e.readline() for reading data. Shantanoo pgpnzvUuzaWwv.pgp Description: PGP signature ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] RSH?
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
Re: [Tutor] RSH?
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 myparticular 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