Skip to content

Commit 208df9e

Browse files
Merge pull request #104 from isteinbrecher/allow-custom-python2-path
Allow custom python2 path
2 parents 7be2e4f + 3637cc1 commit 208df9e

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/cubitpy/conf.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,20 @@ def get_cubit_interpreter(cls):
135135
cubit_python_interpreter = python3_files[0]
136136
return cubit_python_interpreter
137137
else:
138+
python2_path_env = get_path(
139+
"CUBITPY_PYTHON2", os.path.isfile, throw_error=False
140+
)
141+
if python2_path_env is not None:
142+
return python2_path_env
143+
138144
if shutil.which("python2.7") is not None:
139145
return "python2.7"
140146

141-
imcs_python2_path = "/imcs/public/compsim/opt/Python-2.7.18/python"
142-
if os.path.exists(imcs_python2_path):
143-
return imcs_python2_path
144-
145-
raise ValueError("Could not find a python2 interpreter")
147+
raise ValueError(
148+
"Could not find a python2 interpreter. "
149+
"You can specify this by setting the environment variable "
150+
"CUBITPY_PYTHON2 to the path of your python2 interpreter."
151+
)
146152

147153
@classmethod
148154
def is_coreform(cls):

0 commit comments

Comments
 (0)