def chdir(self, path):
if path is None:<EOL><INDENT>self._cwd = None<EOL>return<EOL><DEDENT>if not stat.S_ISDIR(self.stat(path).st_mode):<EOL><INDENT>raise SFTPError(errno.ENOTDIR, "<STR_LIT>" % (os.strerror(errno.ENOTDIR), path))<EOL><DEDENT>self._cwd = self.normalize(path).encode('<STR_LIT:utf-8>')<EOL>
Change the "current directory" of this SFTP session.  Since SFTP
doesn't really have the concept of a current working directory, this
is emulated by ssh.  Once you use this method to set a working
directory, all operations on this SFTPClient object will be relative
to that path. You can pass in C{None} to stop using a current working
directory.

@param path: new current working directory
@type path: str

@raise IOError: if the requested path doesn't exist on the server

@since: 1.4