Skip to content Skip to sidebar Skip to footer

Pathlib.py: Instantiating 'PosixPath' On Windows

I cloned thefuck source code from its repository (this is the real project name, yeah, I know...). Tried to install it for development by the following commands: pip install -r req

Solution 1:

The reason for this error is, that on Windows, PosixPath is not implemented. But there is PurePosixPath, which you can use wherever you want to use PosixPath for platform independent handling of POSIX paths. Alternatively, it might be possible that instead you actually want to have platform dependent paths (that is / on Linux and \ on Windows), in which case you should just use Path.

From the documentation (below the inheritance diagram):

Pure paths are useful in some special cases; for example:

  1. If you want to manipulate Windows paths on a Unix machine (or vice versa). You cannot instantiate a WindowsPath when running on Unix, but you can instantiate PureWindowsPath.

Post a Comment for "Pathlib.py: Instantiating 'PosixPath' On Windows"