An update will be applied December 9th, between 12PM and 1:00PM EST (UTC -5:00). The site may be slow during that time.

Commit dcba6153 authored by David C. Lonie's avatar David C. Lonie
Browse files

Unescape spaces in MPL paths.

Python gets confused otherwise.

Change-Id: Iebe588e121f441061b6f9329ca511adc803cfcec
parent 945cf14e
......@@ -105,6 +105,22 @@ if (debug) \
} \
}
namespace {
//----------------------------------------------------------------------------
// Used to replace "\ " with " " in paths.
void UnEscapeSpaces(std::string &str)
{
size_t pos = str.rfind("\\ ");
while (pos != std::string::npos)
{
str.erase(pos, 1);
pos = str.rfind("\\ ", pos);
}
}
} // end anon namespace
//----------------------------------------------------------------------------
vtkMatplotlibMathTextUtilities* vtkMatplotlibMathTextUtilities::New()
{
......@@ -139,6 +155,7 @@ vtkMatplotlibMathTextUtilities* vtkMatplotlibMathTextUtilities::New()
mplPyHome) &&
mplPyHome.size() != 0)
{
UnEscapeSpaces(mplPyHome);
vtkMplStartUpDebugMacro("VTK_MATPLOTLIB_PYTHONHOME="<<mplPyHome);
Py_SetPythonHome(const_cast<char*>(mplPyHome.c_str()));
}
......@@ -153,6 +170,7 @@ vtkMatplotlibMathTextUtilities* vtkMatplotlibMathTextUtilities::New()
mplPyInterp) &&
mplPyInterp.size() != 0)
{
UnEscapeSpaces(mplPyInterp);
vtkMplStartUpDebugMacro("VTK_MATPLOTLIB_PYTHONINTERP="<<mplPyInterp);
Py_SetProgramName(const_cast<char*>(mplPyInterp.c_str()));
}
......@@ -198,6 +216,7 @@ vtkMatplotlibMathTextUtilities* vtkMatplotlibMathTextUtilities::New()
vtkStdString envPath(envPaths, pathStart + 1,
pathEnd == vtkStdString::npos
? vtkStdString::npos : pathEnd - pathStart);
UnEscapeSpaces(envPath);
PyList_Insert(pypath, 0, PyString_FromString(envPath.c_str()));
pathEnd = pathStart - 1;
pathStart = envPaths.rfind(delim, pathEnd);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment