0

I am trying to build an executable from Python (3.9) source in PyOxidizer.

One of the packages uses importlib.resources to access non-source code files in a subdirectory of itself.

package_root/
    resource_dir/
        resource.file
    __init__.py
    resource_user.py

This is working fine in the python interpreter, but dies in the executable built by PyOxidizer.

The code in resource_user.py is using importlib.resources thus:

from importlib import resources
...
def _get_resource(package, resource):
    ...
    path = resources.files(package)
    ...


loaded_resource = _get_resource(__package__, "resource.file")

The executable dies on the call to resources.files().

I'm hoping this is a tweak to the python_executable or policy objects in pyoxidizer.bzl, but I can't see what it is. Preferably, I want the resources included within the in-memory packages, rather than being sideloaded adjacent files.

mikb
  • 195
  • 13

0 Answers0