diff --git a/src/Base/QuantityPyImp.cpp b/src/Base/QuantityPyImp.cpp index 3f28b3c7cf..dd4c1c2440 100644 --- a/src/Base/QuantityPyImp.cpp +++ b/src/Base/QuantityPyImp.cpp @@ -624,7 +624,11 @@ void QuantityPy::setFormat(Py::Tuple arg) Py::Char form(arg.getItem(1)); fmt.precision = static_cast(prec); +#if PY_MAJOR_VERSION >= 3 + std::string fmtstr = static_cast(Py::String(form)); +#else std::string fmtstr = static_cast(form); +#endif if (fmtstr.size() != 1) throw Py::ValueError("Invalid format character"); switch (fmtstr.front()) {