[issue44162] importlib.resources.path no longer supports directories

2021-05-21 Thread Jason R. Coombs


Change by Jason R. Coombs :


--
resolution:  -> not a bug

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44162] importlib.resources.path no longer supports directories

2021-05-17 Thread Filipe Laíns

Filipe Laíns  added the comment:

Yes, it would be good to properly define resources in the current docs. Though, 
I am left questioning if that definition is still correct, I assume so given 
the implementation. I will open a new bug regarding the documentation of what 
is considered a resource.

Jason, can you close this? Thanks :)

--
nosy: +jaraco

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44162] importlib.resources.path no longer supports directories

2021-05-17 Thread T M


T M  added the comment:

That's fine. I couldn't find anything official on it, but that change is 
working for me.

Thank you!

--
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44162] importlib.resources.path no longer supports directories

2021-05-17 Thread Filipe Laíns

Filipe Laíns  added the comment:

Directories are not resources, the reason it previously worked was purely 
accidental.

I assume you already found a solution in 
https://github.com/python/importlib_resources/issues/85, which would be

importlib.resources.files(__package__) / 'dir'

Can this be closed then?

--
nosy: +FFY00

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44162] importlib.resources.path no longer supports directories

2021-05-17 Thread T M


T M  added the comment:

importlib_resources 1.1.X also behaves this way: 
https://github.com/python/importlib_resources/issues/85

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44162] importlib.resources.path no longer supports directories

2021-05-17 Thread T M


New submission from T M :

In Python 3.7 and 3.8, importlib.resources.path worked perfectly with a 
directory.

For example:

with importlib.resources.path(__package__, "dir") as dir:
os.listdir(dir)

In Python 3.9, this is raised: IsADirectoryError: [Errno 21] Is a directory: 
'dir'

I haven't seen this change documented. I don't know if the behavior in 3.7 and 
3.8 was a bug, it sure was useful.

In this case, we have web files which we want to serve statically from that 
folder. Naming them file by file could work, but would be tedious and isn't 
preferable for us.

Thank you!

--
messages: 393831
nosy: gitpushdashf
priority: normal
severity: normal
status: open
title: importlib.resources.path no longer supports directories
type: behavior
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com