Re: Paramiko help - processing multiple commands

2009-06-24 Thread Noah Dain
    print stdout.read() >>>     client.close() >>> >>> #--Initialization- >>> if __name__ == "__main__": >>>     options() >>>     storagessh() >> >> Again, as you were asked on the original post -- full tracebacks and >> explain "what is not working". >> >> The use of global variables scares me -- why are those needed? >> -- >> http://mail.python.org/mailman/listinfo/python-list >> > -- > http://mail.python.org/mailman/listinfo/python-list > this works for me: def storagessh(): paramiko.util.log_to_file(plog) client = paramiko.SSHClient() client.load_system_host_keys() client.connect(hostname, sshport, suser) stdin, stdout, stderr = client.exec_command('ps') print stdout.read() stdin, stdout, stderr = client.exec_command('help') print stdout.read() client.close() 1) you reassign stdin, stdout, stderr so with your code you will never see the stdout of the first command ('show') 2) the 'show' command did not exist on my system, so no output. I substituted 'ps' and added the print statement also, using user 'root' for dev code is a Bad Thing. -- Noah Dain -- http://mail.python.org/mailman/listinfo/python-list

Re: run shell commands

2008-01-10 Thread Noah Dain
ly by writing to a Popen pipe. A lot of people also use the pexpect python library to "drive" other programs, especially if you need python to act differently depending upon the output of the called programs. Either way, this list's archives do have some good examples as to the u

Re: Strict mode?

2007-12-18 Thread Noah Dain
of them are found and adjusted appropriately. . Homepage: http://bicyclerepair.sourceforge.net/ -- Noah Dain "The beatings will continue, until morale improves" - the Management -- http://mail.python.org/mailman/listinfo/python-list