diff --git a/mrv2/lib/mrvApp/App.cpp b/mrv2/lib/mrvApp/App.cpp index b9583c7d6..e7e1f87f1 100644 --- a/mrv2/lib/mrvApp/App.cpp +++ b/mrv2/lib/mrvApp/App.cpp @@ -11,6 +11,7 @@ # include namespace py = pybind11; # include "mrvPy/Cmds.h" +# include "mrvPy/PyStdErrOutRedirect.h" #endif #include @@ -63,8 +64,6 @@ namespace py = pybind11; #include "mrvApp/mrvOpenSeparateAudioDialog.h" #include "mrvApp/mrvSettingsObject.h" -#include "mrvPy/PyStdErrOutRedirect.h" - #include "mrvPreferencesUI.h" #include "mrViewer.h" @@ -165,7 +164,9 @@ namespace mrv ImageListener* imageListener = nullptr; #endif +#ifdef MRV2_PYBIND11 std::unique_ptr pythonStdErrOutRedirect; +#endif std::shared_ptr playlistsModel; std::shared_ptr filesModel; std::shared_ptr< diff --git a/mrv2/lib/mrvPy/PyStdErrOutRedirect.h b/mrv2/lib/mrvPy/PyStdErrOutRedirect.h index 5708ee9df..e2a441dec 100644 --- a/mrv2/lib/mrvPy/PyStdErrOutRedirect.h +++ b/mrv2/lib/mrvPy/PyStdErrOutRedirect.h @@ -24,11 +24,11 @@ namespace mrv auto sysm = py::module::import("sys"); _stdout = sysm.attr("stdout"); _stderr = sysm.attr("stderr"); - auto stdout = py::module::import("mrv2").attr("FLTKRedirectOutput"); - auto stderr = py::module::import("mrv2").attr("FLTKRedirectError"); - _stdout_buffer = stdout(); + auto out = py::module::import("mrv2").attr("FLTKRedirectOutput"); + auto err = py::module::import("mrv2").attr("FLTKRedirectError"); + _stdout_buffer = out(); // such as objects created by pybind11 - _stderr_buffer = stderr(); + _stderr_buffer = err(); sysm.attr("stdout") = _stdout_buffer; sysm.attr("stderr") = _stderr_buffer; }