This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: os.chdir() et al: is the path str or bytes?
Type: Stage: resolved
Components: Documentation Versions: Python 3.0
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: ezio.melotti Nosy List: ceder, ezio.melotti, georg.brandl
Priority: low Keywords:

Created on 2008-09-09 05:21 by ceder, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg72820 - (view) Author: Per Cederqvist (ceder) Date: 2008-09-09 05:21
The documentation at doesn't specify
if the path argument to os.chdir() should be a str or a bytes, or if
maybe both are acceptable.  This is true for most of the
file-manipulating functions in the os module.

os.listdir() talks about Unicode objects.  It should probably talk about
bytes and str instead.
msg90092 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2009-07-04 00:58
At the beginning of the page[1] there's a note that says: "All functions
accepting path or file names accept both bytes and string objects, and
result in an object of the same type, if a path or file name is returned."
This applies to os.chdir() too (both work, however it doesn't return

The doc for os.listdir[2] now says: "This function can be called with a
bytes or string argument. In the bytes case, all filenames will be
listed as returned by the underlying API. In the string case, filenames
will be decoded using the file system encoding, and skipped if a
decoding error occurs." so the second problem you mentioned seems
already fixed.

Date User Action Args
2022-04-11 14:56:38adminsetgithub: 48060
2009-07-04 15:51:58r.david.murraysetstatus: pending -> closed
resolution: out of date
stage: resolved
2009-07-04 00:58:07ezio.melottisetstatus: open -> pending

messages: + msg90092
2009-07-01 11:06:57ezio.melottisetpriority: low
assignee: georg.brandl -> ezio.melotti

nosy: + ezio.melotti
2008-09-09 05:21:15cedercreate