It's confusing, but this isn't a bug.

As you mention, pathlib.Path.path isn't documented, and there's a reason
for that.  In Python 3.5, pathlib is still technically a provisional
API, which you can see mentioned in the doc page.  That means that the
API can change in backward incompatible ways, which you've seen here.

The .path attribute was an attempt at making pathlib objects more
compatible with other APIs that require paths-as-strings, but it really
didn't work very well.  There was extensive discussion on various
mailing lists about how to go forward and the outcome of that was PEP
519:

https://www.python.org/dev/peps/pep-0519/

So in Python 3.6 there will be a blessed protocol for interoperability
between pathlib paths and str paths, but this is not backported to 3.5.
PEP 519 also says:

"""
The path attribute will be removed as this PEP makes it redundant (it has not 
been included in any released version of Python and so is not a 
backwards-compatibility concern).
"""

Technically true, but I suspect because Matthias uploads inter-release
snapshots, you got caught in the small window where the attribute
existed between the 3.5.1 and 3.5.2 releases, and before it got removed
upstream.

Until 3.6 is available, str(path) is your best workaround.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1604147

Title:
  pathlib.Path.path attribute has disappeared

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python3.5/+bug/1604147/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to