Any idea why I'd see `_pickle.PicklingError: Can't...
# general
s
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
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
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
s
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
No clue (shouldn't be the case), but you are in a position to find out with some logging added.
s
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
You had a question about argv, clearly you could answer that question by logging argv.
s
😅 Right