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

silly-queen-7197

03/07/2023, 9:35 PM
Any idea why I'd see
_pickle.PicklingError: Can't pickle <class 'pex.enum.Enum'>: it's not the same object as pex.enum.Enum
when running something as a pex? It works fine running as a module
e

enough-analyst-54434

03/07/2023, 9:51 PM
What version of Pex?
unzip -qc your.pex PEX-INFO | jq .
I am not aware of any pickling Pex does. Does your app try to use Pex as a library?
s

silly-queen-7197

03/07/2023, 10:00 PM
The application runs apache beam locally. We don't pickle anything directly
Copy code
"pex_version": "2.1.108"
A coworker ran into this, I can't seem to reproduce it atm. Will provide more details if it lingers
e

enough-analyst-54434

03/08/2023, 12:28 AM
s

silly-queen-7197

03/08/2023, 12:35 AM
I guess I got a modified version of the code when I tried id.
Copy code
pex_binary(
    name="dataflow-main",
    entry_point="dataflow.dataflow",
)
works but
Copy code
pex_binary(
    name="dataflow-main",
    entry_point="dataflow.dataflow:run_pipeline",
)
does not.
run_pipeline
takes an argument
argv
. Did
pex
pass itself to the function as argument 0? This is not the case, they removed the argument.
e

enough-analyst-54434

03/08/2023, 12:38 AM
No clue (shouldn't be the case), but you are in a position to find out with some logging added.
s

silly-queen-7197

03/08/2023, 12:50 AM
Setting
execution_mode="venv"
fixed it
Thanks for helping me debug this!
I think I'm missing something, what kind of logging did you have in mind?
e

enough-analyst-54434

03/08/2023, 1:15 AM
You had a question about argv, clearly you could answer that question by logging argv.
s

silly-queen-7197

03/08/2023, 1:21 AM
😅 Right