+++ 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