[New-bugs-announce] [issue45427] importlib.readers.MultiplexedPath

David Rajaratnam report at bugs.python.org
Mon Oct 11 02:06:02 EDT 2021


New submission from David Rajaratnam <daver at gemarex.com.au>:

I'm trying to use `importlib.resources.files()`. However, I cannot work out how to properly use the `importlib.readers.MultiplexedPath()` object that is returned.

As I expect and want, the returned object is referring to a directory, but I cannot seem to simply access the value of that path. 

For a normal `pathlib.Path` object you can get a OS specific path by simply converting to the string representation (eg., 'str(pathlib.Path('/somepath') == '/somepath'). However, for the MutiplexedPath object the __str__() value is the same as the __repr__() (e.g., "MultiplexedPath('/somepath')").

It seems that this is a bug since I would expect MultiplexedPath to behave the same as pathlib.Path in this regard. In the meantime is there a way to actually access this data without stripping the prefix and suffix of this string?

----------
components: Library (Lib)
messages: 403621
nosy: daveraja
priority: normal
severity: normal
status: open
title: importlib.readers.MultiplexedPath
type: behavior
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45427>
_______________________________________


More information about the New-bugs-announce mailing list