Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sftp> cd 'Folder Name'
- with pysftp.Connection('', username='',
- password='') as sftp:
- print sftp.listdir()
- sftp.cwd(sftp.listdir()[0])
- print sftp.listdir()
- [u'Folder Name', u'Name of Folder 2']
- ---------------------------------------------------------------------------
- IOError Traceback (most recent call last)
- <ipython-input-192-10c21db80d5f> in <module>()
- 3 print sftp.listdir()
- 4 sftp.cwd(sftp.listdir()[0])
- ----> 5 print sftp.listdir()
- 6
- /Users/uname/anaconda/lib/python2.7/site-packages/pysftp.pyc in listdir(self, remotepath)
- 574 """
- 575 self._sftp_connect()
- --> 576 return sorted(self._sftp.listdir(remotepath))
- 577
- 578 def listdir_attr(self, remotepath='.'):
- /Users/uname/anaconda/lib/python2.7/site-packages/paramiko/sftp_client.pyc in listdir(self, path)
- 170 :param str path: path to list (defaults to ``'.'``)
- 171 """
- --> 172 return [f.filename for f in self.listdir_attr(path)]
- 173
- 174 def listdir_attr(self, path='.'):
- /Users/uname/anaconda/lib/python2.7/site-packages/paramiko/sftp_client.pyc in listdir_attr(self, path)
- 191 path = self._adjust_cwd(path)
- 192 self._log(DEBUG, 'listdir(%r)' % path)
- --> 193 t, msg = self._request(CMD_OPENDIR, path)
- 194 if t != CMD_HANDLE:
- 195 raise SFTPError('Expected handle')
- /Users/uname/anaconda/lib/python2.7/site-packages/paramiko/sftp_client.pyc in _request(self, t, *arg)
- 728 def _request(self, t, *arg):
- 729 num = self._async_request(type(None), t, *arg)
- --> 730 return self._read_response(num)
- 731
- 732 def _async_request(self, fileobj, t, *arg):
- /Users/uname/anaconda/lib/python2.7/site-packages/paramiko/sftp_client.pyc in _read_response(self, waitfor)
- 775 # synchronous
- 776 if t == CMD_STATUS:
- --> 777 self._convert_status(msg)
- 778 return t, msg
- 779 if fileobj is not type(None):
- /Users/uname/anaconda/lib/python2.7/site-packages/paramiko/sftp_client.pyc in _convert_status(self, msg)
- 801 elif code == SFTP_NO_SUCH_FILE:
- 802 # clever idea from john a. meinel: map the error codes to errno
- --> 803 raise IOError(errno.ENOENT, text)
- 804 elif code == SFTP_PERMISSION_DENIED:
- 805 raise IOError(errno.EACCES, text)
- IOError: [Errno 2] File not found
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement