Why chdir command doesn't work with client.get_transport() ?

Charles_hans charles_hans at yahoo.com
Sun Feb 3 00:41:50 CET 2008


I am new to paramiko. I wrote a script to copy files between Solaris and XP
machines as below:

import paramiko
def exec_command(trans, command):
    chan = trans.open_session()
    chan.exec_command(command)
    stdin = chan.makefile('wb')
    stdout = chan.makefile('rb')
    stderr = chan.makefile_stderr('rb')
    return stdin, stdout, stderr
def main():
    client = paramiko.SSHClient()
    client.connect(hostname, username=username, password=password)
    trans = client.get_transport()
    dummy_chan = trans.open_session()
    exec_command(trans, 'cd temp')
    stdin, stdout, stderr = exec_command(pwd)

>From the last line I found from stdout that the pwd is not changed. I tried
to type the full path in 'cd', did not help. Other UNIX commands such as ls,
mkdir, cp, rm will work. Only this 'cd' never works. I got stuck here.

Please help. Thanks!

Charles
2/2
-- 
View this message in context: http://www.nabble.com/Why-chdir-command-doesn%27t-work-with-client.get_transport%28%29---tp15248798p15248798.html
Sent from the Python - python-list mailing list archive at Nabble.com.




More information about the Python-list mailing list