Alex Carney

Python 3.x Gotchas

Beware pathlib on 3.5

While pathlib exists in Python 3.5, it’s not fully integrated yet. Passing a pathlib.Path object to the built-in open method will result in a surprising error

TypeError: invalid file: PosixPath('path/to/file.txt')

In this situation it’s better to call the path’s open() method instead.