[issue45427] importlib.readers.MultiplexedPath

2021-10-18 Thread David Rajaratnam
David Rajaratnam added the comment: Hi Jason, Thanks for the extra pointers. My initial intention in explaining my use-case was to find out whether treating an externally embedded interpreter's files as `importlib.resources` is the correct use of this library. However, you're right that

[issue45427] importlib.readers.MultiplexedPath

2021-10-18 Thread Jason R. Coombs
Jason R. Coombs added the comment: Thanks Dave for closing. I would recommend in the future if you have packaging questions to bring them to packaging problems repo as indicated at https://packaging.python.org/support/#how-to-get-support. Glad to hear that `as_file` promised to do what you

[issue45427] importlib.readers.MultiplexedPath

2021-10-17 Thread David Rajaratnam
David Rajaratnam added the comment: I'm closing the bug report. Clearly not a bug. It looks like importlib.resources.as_file() is exactly what I want. It returns a context and can potentially create a temporary file system directory structure with all files I want underneath. Not sure how I

[issue45427] importlib.readers.MultiplexedPath

2021-10-17 Thread David Rajaratnam
David Rajaratnam added the comment: Hi Filipe, Thanks very much for the pointers and for the clarifications. I'll look at using importlib.resources.as_file(). I think this is the API that I stupidly seemed to have missed! However, it is also very possible that I am misunderstanding the

[issue45427] importlib.readers.MultiplexedPath

2021-10-15 Thread Filipe Laíns
Filipe Laíns added the comment: *realize I did *not* point this out :facepalm: sorry! -- ___ Python tracker ___ ___

[issue45427] importlib.readers.MultiplexedPath

2021-10-15 Thread Filipe Laíns
Filipe Laíns added the comment: Just to clarify, as I realize I did point this out in my reply, Traversable[1][2] is the protocol that objects returned by importlib.resources.files implement. [1] https://docs.python.org/3/library/importlib.html#importlib.abc.Traversable [2]

[issue45427] importlib.readers.MultiplexedPath

2021-10-15 Thread Filipe Laíns
Filipe Laíns added the comment: The Traversable protocol does not guarantee you access to the file-system path. pathlib.Path happens to give you that information, but other traversables are not required to. The main reasoning for this is that traversables do not need to exist on the

[issue45427] importlib.readers.MultiplexedPath

2021-10-11 Thread David Rajaratnam
David Rajaratnam added the comment: Thanks for the quick response. I think the attached file shows the issue. In the directory where you download and run this file create a sub-directory 'data'. Then running the file creates the output (note: I've truncated the path name): > Traverse

[issue45427] importlib.readers.MultiplexedPath

2021-10-11 Thread Eric V. Smith
Eric V. Smith added the comment: Can you provide a short code snippet that we can run that demonstrates the problem? Looking at the code, and not knowing much about it, maybe iterating over the paths with .iterdir() is what you want? -- nosy: +eric.smith

[issue45427] importlib.readers.MultiplexedPath

2021-10-11 Thread David Rajaratnam
New submission from David Rajaratnam : 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