Tips for Using the Paramiko SFTP Client
Friday, June 19th, 2009The Paramiko library seems to be the best way to do an SFTP client in Python.
Here is a good example of set up and usage.
However in connecting to a WS FTP server, I was still hitting some problems.
When I tried to do:
sftp.get(remotepath='setup.py',localpath='setup.py')
I got:
*** IOError: Folder not found: setup.py
and when I tried:
sftp.sftp.get(remotepath='./setup.py',localpath='setup.py')
I got:
*** IOError: [Errno 13] Permission Denied!
It turns out the trick for working with WS FTP Server, you need to reference your files as current_directory/filename. (no idea why!)
So the correct command is:
sftp.sftp.get(remotepath='greg/setup.py',localpath='setup.py')
where greg is my current working directory (yes, even though I’m already in that directory!)