Skip to content

Commit 0be05eb

Browse files
committed
Set pythonpath
1 parent 712ec5d commit 0be05eb

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

shellwhat/parsers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class OshParser(AstModule):
2323
def parse(cls, code, strict=True):
2424
try:
2525
res = check_output(
26-
PARSER_OSH_STUB + [code], env=dict(os.environ, PYENV_VERSION="2.7.10")
26+
PARSER_OSH_STUB + [code], env=dict(os.environ, PYENV_VERSION="2.7.10", PYTHONPATH=getattr(cls, "PYTHONPATH", None))
2727
)
2828
ast_dict = json.loads(res.decode())
2929
if ast_dict is None:
@@ -65,6 +65,7 @@ def parse(cls, *args, **kwargs):
6565
# Determine which parser to use and how it is called.
6666
# By default, the DummyParser is used.
6767
parse_opt = os.environ.get("SHELLWHAT_PARSER", "osh")
68+
setattr(OshParser, "PYTHONPATH", "/var/lib/python/site-packages/python2")
6869
if parse_opt == "osh":
6970
DEFAULT_PARSER = OshParser
7071
PARSER_OSH_STUB = ["python2", "-m", "osh"]

0 commit comments

Comments
 (0)