Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. sftp> cd 'Folder Name'
  2.  
  3. with pysftp.Connection('', username='',
  4. password='') as sftp:
  5. print sftp.listdir()
  6. sftp.cwd(sftp.listdir()[0])
  7. print sftp.listdir()
  8.  
  9. [u'Folder Name', u'Name of Folder 2']
  10. ---------------------------------------------------------------------------
  11. IOError Traceback (most recent call last)
  12. <ipython-input-192-10c21db80d5f> in <module>()
  13. 3 print sftp.listdir()
  14. 4 sftp.cwd(sftp.listdir()[0])
  15. ----> 5 print sftp.listdir()
  16. 6
  17.  
  18. /Users/uname/anaconda/lib/python2.7/site-packages/pysftp.pyc in listdir(self, remotepath)
  19. 574 """
  20. 575 self._sftp_connect()
  21. --> 576 return sorted(self._sftp.listdir(remotepath))
  22. 577
  23. 578 def listdir_attr(self, remotepath='.'):
  24.  
  25. /Users/uname/anaconda/lib/python2.7/site-packages/paramiko/sftp_client.pyc in listdir(self, path)
  26. 170 :param str path: path to list (defaults to ``'.'``)
  27. 171 """
  28. --> 172 return [f.filename for f in self.listdir_attr(path)]
  29. 173
  30. 174 def listdir_attr(self, path='.'):
  31.  
  32. /Users/uname/anaconda/lib/python2.7/site-packages/paramiko/sftp_client.pyc in listdir_attr(self, path)
  33. 191 path = self._adjust_cwd(path)
  34. 192 self._log(DEBUG, 'listdir(%r)' % path)
  35. --> 193 t, msg = self._request(CMD_OPENDIR, path)
  36. 194 if t != CMD_HANDLE:
  37. 195 raise SFTPError('Expected handle')
  38.  
  39. /Users/uname/anaconda/lib/python2.7/site-packages/paramiko/sftp_client.pyc in _request(self, t, *arg)
  40. 728 def _request(self, t, *arg):
  41. 729 num = self._async_request(type(None), t, *arg)
  42. --> 730 return self._read_response(num)
  43. 731
  44. 732 def _async_request(self, fileobj, t, *arg):
  45.  
  46. /Users/uname/anaconda/lib/python2.7/site-packages/paramiko/sftp_client.pyc in _read_response(self, waitfor)
  47. 775 # synchronous
  48. 776 if t == CMD_STATUS:
  49. --> 777 self._convert_status(msg)
  50. 778 return t, msg
  51. 779 if fileobj is not type(None):
  52.  
  53. /Users/uname/anaconda/lib/python2.7/site-packages/paramiko/sftp_client.pyc in _convert_status(self, msg)
  54. 801 elif code == SFTP_NO_SUCH_FILE:
  55. 802 # clever idea from john a. meinel: map the error codes to errno
  56. --> 803 raise IOError(errno.ENOENT, text)
  57. 804 elif code == SFTP_PERMISSION_DENIED:
  58. 805 raise IOError(errno.EACCES, text)
  59.  
  60. IOError: [Errno 2] File not found
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement