diff --git a/src/dynamic-graph-py.cc b/src/dynamic-graph-py.cc
index a57eb8e04e86312409ac7ce856bc4d78dd121e8c..b3a993b1a92832a7624156950450c1bf4de2f10c 100644
--- a/src/dynamic-graph-py.cc
+++ b/src/dynamic-graph-py.cc
@@ -142,8 +142,10 @@ initwrap(void)
     if (m == NULL)
         return;
 
+    std::string msg("dynamic_graph.wrap.error");
+
     dynamicgraph::python::error =
-      PyErr_NewException("dynamic_graph.wrap.error", NULL, NULL);
+      PyErr_NewException(const_cast<char*>(msg.c_str()), NULL, NULL);
     Py_INCREF(dynamicgraph::python::error);
     PyModule_AddObject(m, "error", dynamicgraph::python::error);
 }