Skip to main content

Object-oriented filesystem paths

Project description

As of January 1 2020, this repository will no longer receive any further updates, as Python 2 is no longer supported.

The old pathlib module on bitbucket is in bugfix-only mode. The goal of pathlib2 is to provide a backport of standard pathlib module which tracks the standard library module, so all the newest features of the standard pathlib can be used also on older Python versions.


Standalone releases are available on PyPI:


The main development takes place in the Python standard library: see the Python developer’s guide. In particular, new features should be submitted to the Python bug tracker.

Issues that occur in this backport, but that do not occur not in the standard Python pathlib module can be submitted on the pathlib2 bug tracker.


Refer to the standard pathlib documentation.

Known Issues

For historic reasons, pathlib2 still uses bytes to represent file paths internally. Unfortunately, on Windows with Python 2.7, the file system encoder (mcbs) has only poor support for non-ascii characters, and can silently replace non-ascii characters without warning. For example, u'тест'.encode(sys.getfilesystemencoding()) results in ???? which is obviously completely useless.

Therefore, on Windows with Python 2.7, until this problem is fixed upstream, unfortunately you cannot rely on pathlib2 to support the full unicode range for filenames. See issue #56 for more details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pathlib2, version 2.3.6
Filename, size File type Python version Upload date Hashes
Filename, size pathlib2-2.3.6.tar.gz (38.4 kB) File type Source Python version None Upload date Hashes View
Filename, size pathlib2-2.3.6-py2.py3-none-any.whl (17.5 kB) File type Wheel Python version py2.py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page