[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

pysftp / paramiko problem

I am trying to convert older code that uses ftplib as the endpoint has switched to sftp only.

I am using the pysftp wrapper around paramiko.

The following script fails

def main():
     import pysftp
     with pysftp.Connection('', username='me', password='xxxxxx') as sftp:
         print('top level')
         print('direct list of XXXX')

if __name__ == '__main__':

when run the program prints [u'XXXX'] and then fails at the normalize command.

> $ python
> top level
> [u'XXXX']
> Traceback (most recent call last):
>   File "", line 13, in <module>
>     main()
>   File "", line 6, in main
>     print(sftp.normalize(u'XXXX'))
>   File "/home/rptlab/devel/env/lib/python2.7/site-packages/pysftp/", line 640, in normalize
>     return self._sftp.normalize(remotepath)
>   File "/home/rptlab/devel/env/lib/python2.7/site-packages/paramiko/", line 632, in normalize
>     t, msg = self._request(CMD_REALPATH, path)
>   File "/home/rptlab/devel/env/lib/python2.7/site-packages/paramiko/", line 813, in _request
>     return self._read_response(num)
>   File "/home/rptlab/devel/env/lib/python2.7/site-packages/paramiko/", line 865, in _read_response
>     self._convert_status(msg)
>   File "/home/rptlab/devel/env/lib/python2.7/site-packages/paramiko/", line 894, in _convert_status
>     raise IOError(errno.ENOENT, text)
> IOError: [Errno 2] No such file.

I tried other commands, but it seems any attempt to cd to the XXXX directory fails.

Using sftp in the shell directly I needed to add HostKeyAlgorithms=+ssh-dss for this host.

Any pointers to what the problem could be?
Robin Becker