When I spawn subprocesses from my `pex_binary` the...
# general
s
When I spawn subprocesses from my
pex_binary
the subprocesses don’t seem to have the same dependencies available. Do I need to manually set something to propagate environments to spawned processes?
1
b
Are they Python subprocesses?
s
Yeah
b
If so, this is "fixed" in newer PEX (therefore newer Pants) See https://github.com/pantsbuild/pex/issues/1825 There's also a workaround of setting
PYTHONPATH
in the
env
argument when running the subprocess using
sys,path
s
oh nice, timely
do you know what release I need to pick this change up?
b
I just switched to mobile, so I couldn't tell you immediately. There's also support to use newer PEX in an older Pants, but YMMV
s
okay I think this is working with the latest RC that’ll be okay at least for now
thanks!
b
Hot tip, invoke code using -m and the module name. And make sure the module is in its own string. Then enable Pants string import inference 😉
n
Does this mean we don't need
env={**os.environ, **{“PYTHONPATH”: “:”.join(sys.path)}}
for Popen anymore?
h
I believe so