os.
chdir
(path)
os.
chdir
(path)Change the current working directory to path.
This function can support specifying a file descriptor. The descriptor must refer to an opened directory, not an open file.
This function can raise OSError
and subclasses such as FileNotFoundError
, PermissionError
, and NotADirectoryError
.
Raises an auditing event os.chdir
with argument path
.
New in version 3.3: Added support for specifying path as a file descriptor on some platforms.
Changed in version 3.6: Accepts a path-like object.
Related Reading