OxidizedFinder.path_hook errors when being called on a Windows filesystem path directly. This use case works for regular python sys.path_hooks.
more info
I have a pyoxidizer generated windows executable that is running a django application. Because django is as django does, it relies on being on the filesystem. So I have configured pyoxidizer like so:
This works, and django starts up without issue, and everything can be imported, __file__/__path__ work as advertised.
However, when it then serves a request, it lazily loads django's templating engine, which includes scanning for template tags amongst installed packages, via pkgutils.walk_packages, which ends up iterating through sys.path_hooks (which only contains the pyoxidizer hook), and calls the oxidizer path hook with the file path like so:
It returns an error: *** ImportError: error running OxidizedFinder.path_hook
This means django doesn't load the templatetags things generally go down hill.
With normal system python and its sys.path_hooks, this exact same path imports just fine. Running import $PACKAGE works fine too, so I don't think its fundamentally an issue with the specific module files on disk, but maybe something do with pyoxidizer's sys.path_hooks setup when using filesystem-relative resource location?
tldr
OxidizedFinder.path_hook errors when being called on a Windows filesystem path directly. This use case works for regular python sys.path_hooks.
more info
I have a pyoxidizer generated windows executable that is running a django application. Because django is as django does, it relies on being on the filesystem. So I have configured pyoxidizer like so:
policy.resources_location = "filesystem-relative:lib"
This works, and django starts up without issue, and everything can be imported,
__file__
/__path__
work as advertised.However, when it then serves a request, it lazily loads django's templating engine, which includes scanning for template tags amongst installed packages, via
pkgutils.walk_packages
, which ends up iterating throughsys.path_hooks
(which only contains the pyoxidizer hook), and calls the oxidizer path hook with the file path like so:i.e. on the filesystem-relative path.
It returns an error:
*** ImportError: error running OxidizedFinder.path_hook
This means django doesn't load the templatetags things generally go down hill.
With normal system python and its
sys.path_hooks
, this exact same path imports just fine. Runningimport $PACKAGE
works fine too, so I don't think its fundamentally an issue with the specific module files on disk, but maybe something do with pyoxidizer's sys.path_hooks setup when usingfilesystem-relative
resource location?