https://pantsbuild.org/ logo
#general
Title
# general
b

brash-family-72057

04/08/2023, 12:36 AM
Trying to produce a binary with
pants.backend.experimental.python.packaging.pyoxidizer
and hitting an issue with argsparse. I’ve been able to successfully run
pants package
, but when running the resulting binary I get an error that seems to stem from the use of
argsparse
Copy code
❯ dist/src.python.mdevxp.code_ownership/code-ownership/aarch64-apple-darwin/debug/install/code-ownership
Traceback (most recent call last):
  File "runpy", line 196, in _run_module_as_main
  File "runpy", line 86, in _run_code
  File "mdevxp.code_ownership.code_ownership_mapper", line 258, in <module>
  File "mdevxp.code_ownership.code_ownership_mapper", line 50, in cli
  File "argparse", line 1717, in __init__
  File "posixpath", line 142, in basename
TypeError: expected str, bytes or os.PathLike object, not NoneType
The same entry point works with pex. If I replace my entrypoint to a hello_world.py script within the same pants package, it works, so it seems like something is not being configured correctly between pyoxidizer and what argsparse expected. Before I go down that rabbit hole, was wondering if anyone has already hit and solved this issue.
w

wide-midnight-78598

04/08/2023, 12:58 AM
Related? https://github.com/indygreg/PyOxidizer/issues/307 PyOx strips the sys.argv (argv[0]), or something equally wonky
Alternatively.......... If you're not married to PyOxidizer, you might be able to make a
scie
out of it? https://github.com/a-scie/jump I've moved away from PyOx due to slow compilation/bundling time, and because of one off weirdness. But the
scie
uses IndyGreg's awesome python-build-standalone, all from the same family of tooling.
b

brash-family-72057

04/13/2023, 12:08 AM
Alternatively.......... If you’re not married to PyOxidizer, you might be able to make a
scie
out of it?
Just prototyping at this point. Will take a look at
scie
to compare.