New submission from T M <teran.mckin...@anthem.com>:

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 <rep...@bugs.python.org>
<https://bugs.python.org/issue44162>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to