Skip to content

Meta: Why the use of os.fsdecode in dodo.py #113

Discussion options

You must be logged in to vote

It's to prevent potential errors from me. 😄 When you take something like a pathlib object, it can have either a string or bytes representation of the path. Since the Python Launcher only supports file paths that can be decoded to a string, I made sure I only supported strings as os.fsdecode() will fail if it can't translate a file path.

There's also the issue of what if I messed up and passed in something that has a string representation for VENV_EXECUTABLE, like None? os.fsdecode() will throw an exception, but just relying on string translation for None will always succeed, leading to potentially subtle errors.

You can read https://www.python.org/dev/peps/pep-0519/ for the historical det…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@FollowTheProcess
Comment options

Answer selected by FollowTheProcess
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants