Skip to content

Commit

Permalink
Fix py_env_runner (RobotLocomotion#22549)
Browse files Browse the repository at this point in the history
Modify py_env_runner to export the PYTHONPATH. This is needed to ensure
that CPython can find everything the Python interpreter in use can find
(particularly when using a virtual environment).
  • Loading branch information
mwoehlke-kitware authored Jan 28, 2025
1 parent 3424937 commit f049112
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tools/skylark/py_env_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
# TODO(eric.cousineau): See if there is a way to do this in pure C++, such
# that it is easier to debug.

import os
import subprocess
import sys

env = os.environ.copy()
env['PYTHONPATH'] = ':'.join([p for p in sys.path if p])

assert len(sys.argv) >= 2
subprocess.check_call(sys.argv[1:])
subprocess.check_call(sys.argv[1:], env=env)

0 comments on commit f049112

Please sign in to comment.