Message403645
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 data: MultiplexedPath('<<abspath-deleted>>/data') (<class 'importlib.readers.MultiplexedPath'>)
I think the idea behind MultiplexedPath() is that it merges together multiple base/root directories so even though in this case it is a single path it wouldn't necessarily be the case in general. So while it makes sense that for some MultiplexedPath object X that str(X) isn't itself a proper directory path, however, there seems to be no method/property to access these root paths.
Note: Traverable.iterdir() iterates over the files/sub-directories in the root(s) so doesn't return the root path(s) themselves.
A further note. If you add a file `data/__init__.py` then data is now a package and running the code this time returns a PosixPath object (on a posix system):
> Traverse data: <<abspath-deleted>>/data (<class 'pathlib.PosixPath'>)
> X: <<abspath-deleted>>/data/__init__.py (<class 'pathlib.PosixPath'>)
> X: <<abspath-deleted>>/data/__pycache__ (<class 'pathlib.PosixPath'>) |
|
Date |
User |
Action |
Args |
2021-10-11 10:03:23 | daveraja | set | recipients:
+ daveraja, eric.smith |
2021-10-11 10:03:23 | daveraja | set | messageid: <1633946603.15.0.078947601516.issue45427@roundup.psfhosted.org> |
2021-10-11 10:03:23 | daveraja | link | issue45427 messages |
2021-10-11 10:03:23 | daveraja | create | |
|