This feels like a very stupid question but I can’t...
# general
s
This feels like a very stupid question but I can’t seem to find the answer: I have a
pex
file that I want to execute by simply running
./my_package.pex
, but I cannot figure out how to pass arguments to the script that’s inside the package. Just adding flags doesn’t seem to get parsed, and passing them via
--
doesn’t work either.
w
when you run a PEX file, the name of the python code that will actually be executed is an `entry_point`: https://www.pantsbuild.org/docs/reference-pex_binary#codeentry_pointcode
s
Is “You must use the file name shorthand for file arguments to work with this target.” what I’m looking for? Not sure what a file argument means in this context
I believe I’m using 1 in my Pants build file
Copy code
pex_binary(
    name="pex_data_extraction",
    entry_point="data_extraction.py",
)
w
ok: and what happens when you run the PEX?
s
the pex runs fine, the issue is that I can’t pass arguments to the underlying python file
w
runs the code you are expecting to run?
s
yeah
it just says
Discarding unparseable args
and then lists all the arguments I pass
I wonder if there’s some weird interaction happening with the way I’m parsing args? Is expected behavior to read the arguments normally?
h
The pex command line should be passed through to your code’s sys.argv
w
yea, you should be able to read them normally.
e
@straight-action-80318 can you provide 3 things for debugging?: 1. The full output of:
PEX_VERBOSE=9 ./pex_data_extraction.pex --bob
2. The full output of:
unzip -qc ./pex_data_extraction.pex PEX-INFO | jq .
3. The full output of: `zipinfo ./pex_data_extraction.pex``
s
I think I figured it out, sorry for the fuss! It was an interaction of apache beam with argument parsing, I don’t think it was a Pex issue
🙌 1