pathlib.py: Instantiating 'PosixPath' on Windows

后端 未结 1 1596
死守一世寂寞
死守一世寂寞 2021-01-12 23:42

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 comm

相关标签:
1条回答
  • 2021-01-12 23:59

    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.
    0 讨论(0)
提交回复
热议问题