diff options
author | Robey Pointer <robey@twitter.com> | 2009-07-19 19:47:53 -0700 |
---|---|---|
committer | Robey Pointer <robey@twitter.com> | 2009-07-19 19:47:53 -0700 |
commit | e56b36648defb3a11e4cc6b8bcd3f945e2d850dc (patch) | |
tree | 3f4036d872f3e9d1a7846b834803cf2007f9955c | |
parent | 60c6e94e7dd6d7ac65c88ce1231f55d311777a34 (diff) |
patch from jim wilcoxson: raise an error early if chdir will fail.
-rw-r--r-- | paramiko/sftp_client.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/paramiko/sftp_client.py b/paramiko/sftp_client.py index 1f0d64ba..bdfb8a55 100644 --- a/paramiko/sftp_client.py +++ b/paramiko/sftp_client.py @@ -23,6 +23,7 @@ Client-mode SFTP support. from binascii import hexlify import errno import os +import stat import threading import time import weakref @@ -507,6 +508,8 @@ class SFTPClient (BaseSFTP): @since: 1.4 """ + if not S_ISDIR(self.stat(path).st_mode): + raise SFTPError(errno.ENOTDIR, "%s: %s" % (os.strerror(errno.ENOTDIR), path)) self._cwd = self.normalize(path) def getcwd(self): |