diff options
-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): |