New submission from giumas: On Windows, I am getting a `SyntaxError` when I try to input commands after having launched a Python 2.7.x interpreter with `subprocess.call`.
This is a minimal example: import os import subprocess def python_env_path(python_path): env = os.environ.copy() python_scripts = os.path.join(python_path, "Scripts") python_bin = os.path.join(python_path, "Library", "bin") path_env = "%s;%s;%s;" % (python_path, python_scripts, python_bin) env['PATH'] = path_env.encode() return env def open_python_prompt(python_path): env = python_env_path(python_path) prc = subprocess.call(["start", "python"], shell=True, cwd=python_path, env=env) if prc != 0: print("Unable to open a Python prompt") return False return True open_python_prompt("C:\Py27x64") When I try to write whatever simple command for the interpreter I get: >>> a = 0 File "<stdin>", line 1 a = 0 ^ SyntaxError: invalid syntax I did not find SO questions that solve my issue. The same code works fine with Python 3.x. The same Python installation works fine if I open a shell and call the interpreter using a batch file. ---------- components: Extension Modules, Windows messages: 260612 nosy: giumas, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: SyntaxError when running Python 2.7 interpreter with subprocess.call type: crash versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26400> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com