Perhaps, but from the info you provided this shoul...
# development
e
Perhaps, but from the info you provided this should not work. Did you leave out a PEX_EXTRA_SYS_PATH or similar from the __run.sh contents?
1
b
Why shouldn't it work? And no, no
PEX_EXTRA_SYS_PATH
e
Because PEXes are hermetic by default and the entry point you specify is loose outside the PEX.
So the PEX purposefully cannot see
__nbconvert.py
unless you tell it to.
For example:
Copy code
jsirois@Gill-Windows:~/dev/pantsbuild/jsirois-scie-pants (install/specialize-setuptools-version *) $ echo "print(f'Here {__file__}')" > loose.py
jsirois@Gill-Windows:~/dev/pantsbuild/jsirois-scie-pants (install/specialize-setuptools-version *) $ pex -oempty.pex
jsirois@Gill-Windows:~/dev/pantsbuild/jsirois-scie-pants (install/specialize-setuptools-version *) $ PEX_MODULE=loose ./empty.pex
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/jsirois/.pex/unzipped_pexes/6d69888624b3304a2671961f15e628c55daf5895/__main__.py", line 106, in <module>
    bootstrap_pex(__entry_point__, execute=__execute__, venv_dir=__venv_dir__)
  File "/home/jsirois/.pex/unzipped_pexes/6d69888624b3304a2671961f15e628c55daf5895/.bootstrap/pex/pex_bootstrapper.py", line 618, in bootstrap_pex
    pex.PEX(entry_point).execute()
  File "/home/jsirois/.pex/unzipped_pexes/6d69888624b3304a2671961f15e628c55daf5895/.bootstrap/pex/pex.py", line 560, in execute
    sys.exit(self._wrap_coverage(self._wrap_profiling, self._execute))
  File "/home/jsirois/.pex/unzipped_pexes/6d69888624b3304a2671961f15e628c55daf5895/.bootstrap/pex/pex.py", line 467, in _wrap_coverage
    return runner(*args)
  File "/home/jsirois/.pex/unzipped_pexes/6d69888624b3304a2671961f15e628c55daf5895/.bootstrap/pex/pex.py", line 498, in _wrap_profiling
    return runner(*args)
  File "/home/jsirois/.pex/unzipped_pexes/6d69888624b3304a2671961f15e628c55daf5895/.bootstrap/pex/pex.py", line 592, in _execute
    return self.execute_entry(
  File "/home/jsirois/.pex/unzipped_pexes/6d69888624b3304a2671961f15e628c55daf5895/.bootstrap/pex/pex.py", line 800, in execute_entry
    return self.execute_module(entry_point.module)
  File "/home/jsirois/.pex/unzipped_pexes/6d69888624b3304a2671961f15e628c55daf5895/.bootstrap/pex/pex.py", line 808, in execute_module
    runpy.run_module(module_name, run_name="__main__", alter_sys=True)
  File "/usr/lib/python3.10/runpy.py", line 220, in run_module
    mod_name, mod_spec, code = _get_module_details(mod_name)
  File "/usr/lib/python3.10/runpy.py", line 140, in _get_module_details
    raise error("No module named %s" % mod_name)
ImportError: No module named loose
jsirois@Gill-Windows:~/dev/pantsbuild/jsirois-scie-pants (install/specialize-setuptools-version *) $ PEX_EXTRA_SYS_PATH=. PEX_MODULE=loose ./empty.pex
Here /home/jsirois/dev/pantsbuild/jsirois-scie-pants/./loose.py
This is extremely old PEX behavior.
b
Huh, well TIL. Thanks
e
So what changed then?
b
Something from Pants I presume in how it runs VenvPEXs? The branch's diff is minimal and the version is the only thing that makes sense
b
Might this be https://github.com/pantsbuild/pants/pull/18582 ? Do you only see the behaviour change when you run with
__run.sh
? Potentially it was previously inheriting something from your shell...
that's 2.17 only, nevermind...