Changed the pypath() routine to reflect its own documentation. If
it fails to find PYTHON_CMD in the environment, it will now return the string python, and not throw an error. WIth this change PYTHON_CMD doesn't have to be set in the user's environment. Instead Cantera will fall back to using the user's default path to find the executable, python.
This commit is contained in:
parent
91ff08255f
commit
23415dbe55
1 changed files with 14 additions and 9 deletions
|
|
@ -1,6 +1,9 @@
|
|||
/**
|
||||
* @file ct2ctml.cpp
|
||||
*
|
||||
* Driver for the system call to the python executable that converts
|
||||
* cti files to ctml files (see \ref inputfiles).
|
||||
*/
|
||||
/*
|
||||
* $Author$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
|
|
@ -30,11 +33,13 @@ using namespace Cantera;
|
|||
|
||||
namespace ctml {
|
||||
|
||||
// return the full path to the Python interpreter. Use
|
||||
// environment variable PYTHON_CMD if it is set. If not, return
|
||||
// the string 'python'.
|
||||
//! return the full path to the Python interpreter.
|
||||
/*!
|
||||
* Use the environment variable PYTHON_CMD if it is set. If not, return
|
||||
* the string 'python'.
|
||||
*/
|
||||
static string pypath() {
|
||||
string s = "ctpython";
|
||||
string s = "python";
|
||||
const char* py = getenv("PYTHON_CMD");
|
||||
if (!py) {
|
||||
const char* hm = getenv("HOME");
|
||||
|
|
@ -50,10 +55,10 @@ namespace ctml {
|
|||
s = sp;
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw CanteraError("ct2ctml",
|
||||
"set environment variable PYTHON_CMD");
|
||||
}
|
||||
//else {
|
||||
// throw CanteraError("ct2ctml",
|
||||
// "set environment variable PYTHON_CMD");
|
||||
//}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue