Skip to content

Commit adea250

Browse files
committed
Also try open_resource for path operation.
1 parent 1526d8a commit adea250

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

importlib_resources/_py3.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ def path(package: Package, resource: Resource) -> Iterator[Path]:
154154
with suppress(FileNotFoundError):
155155
yield Path(reader.resource_path(norm_resource))
156156
return
157+
opener_reader = reader.open_resource(norm_resource)
158+
with trees._tempfile(opener_reader.read) as res:
159+
yield res
160+
return
157161
with trees.as_file(get(package, resource)) as res:
158162
yield res
159163

0 commit comments

Comments
 (0)