indygreg / PyOxidizer

A modern Python application packaging and distribution tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

execution of a pyoxidizer binary fails if importing a file with spaces

mark-thm opened this issue · comments

Running the following configuration to build and run scoutsuite==5.13.0 results in a successful build but an un-runnable package:

def make_exe():
    dist = default_python_distribution()
    policy = dist.make_python_packaging_policy()
    policy.resources_location = "filesystem-relative:lib"
    policy.resources_location_fallback = "filesystem-relative:lib"
    python_config = dist.make_python_interpreter_config()
    python_config.run_module = "ScoutSuite"
    exe = dist.to_python_executable(
        name = "scout-oxide",
        packaging_policy = policy,
        config = python_config,
    )
    exe.add_python_resources(exe.pip_install(["scoutsuite==5.13.0"]))
    return exe

At runtime it fails with this error:

Traceback (most recent call last):
  File "runpy", line 196, in _run_module_as_main
  File "runpy", line 86, in _run_code
  File "ScoutSuite.__main__", line 15, in <module>
  File "ScoutSuite.core.server", line 2, in <module>
  File "cherrypy", line 66, in <module>
  File "cherrypy._cperror", line 135, in <module>
  File "cherrypy.lib.httputil", line 20, in <module>
  File "jaraco.collections", line 12, in <module>
  File "jaraco.text", line 231, in <module>
  File "importlib.abc", line 378, in read_text
  File "importlib._adapters", line 54, in open
ValueError

jaroco.text is trying to load a file from the python path with a space in it.

The maintainer of jaroco.text has made clear that files with spaces in them should be valid and is not willing to remove the space or modify the code that loads the file, and has requested that when encountering tools that don't support files with spaces to file upstream issues. (See 1, 2)

While not a minimal repro, I'm pretty sure this is pyoxidizer running into an issue with files with spaces on the python path.