diff --git a/src/convert-dg-to-py.cc b/src/convert-dg-to-py.cc
index a502b0e507b109a833b60bd7ebe0ce71efe3932e..6a6fe8e8fbcf092ab3d49c017b05d0aa18a5cf3b 100644
--- a/src/convert-dg-to-py.cc
+++ b/src/convert-dg-to-py.cc
@@ -73,7 +73,7 @@ namespace dynamicgraph {
 	    throw ExceptionPython(ExceptionPython::VALUE_PARSING,
 				   "bool");
 	  }
-	  bvalue = (pyObject == Py_True);
+	  bvalue = PyObject_IsTrue(pyObject);
 	  return Value(bvalue);
 	  break;
 	case (Value::UNSIGNED) :
diff --git a/src/dynamic-graph-py.cc b/src/dynamic-graph-py.cc
index aed5d5357b123ba59bd36cabb005bcc583e35762..0303fa72528fa7b92847d91651dfdb49be34bed2 100644
--- a/src/dynamic-graph-py.cc
+++ b/src/dynamic-graph-py.cc
@@ -114,7 +114,7 @@ namespace dynamicgraph {
 			  "second argument a filename.");
 	  return NULL;
 	}
-	if (boolean == Py_True) {
+	if (PyObject_IsTrue(boolean)) {
 	  try {
 	    DebugTrace::openFile(filename);
 	  } catch (const std::exception& exc) {
diff --git a/src/dynamic_graph/attrpath.py b/src/dynamic_graph/attrpath.py
index d10778d44d6d1f94ee61125e763c571ff1162399..cdb6c7d3730ecb9d7f01da093272f41e06ac2a22 100644
--- a/src/dynamic_graph/attrpath.py
+++ b/src/dynamic_graph/attrpath.py
@@ -73,7 +73,7 @@ def setattrpath( target,path,attribute ):
     if callable(attribute):
         createCommandLauncher( pathk,path[-1],attribute )
     else:
-        print "Should not happen"
+        print("Should not happen")
         setattr(pathk,path[-1],attribute )
 
 def getattrpath( target,path ):
@@ -100,7 +100,7 @@ def existattrpath( target,path ):
     pathk=target
     if type(path)==type(str()): path=path.split('.')
     for tokenk in path[0:-1]:
-        print 'check ',tokenk
+        print('check ',tokenk)
         privateName=tokenk+"_obj"
         if (privateName not in pathk.__dict__):
             return False
diff --git a/src/dynamic_graph/entity.py b/src/dynamic_graph/entity.py
index 7b140da47fb08409fba5eddb171c6d25d6381573..6d49da3a5d346f6bce9375aeb521dff74db0b0aa 100644
--- a/src/dynamic_graph/entity.py
+++ b/src/dynamic_graph/entity.py
@@ -202,7 +202,7 @@ class Entity (object) :
         are not made with the class, but directly with the object instance.
         """
         if (cmdName in self.__dict__) | (cmdName in self.__class__.__dict__):
-            print "Warning: command ",cmdName," will overwrite an object attribute."
+            print("Warning: command ",cmdName," will overwrite an object attribute.")
         docstring = wrap.entity_get_command_docstring(self.obj, cmdName)
         cmd = Entity.createCommandBind(cmdName,docstring)
         # Limitation (todo): does not handle for path attribute name (see setattrpath).
diff --git a/src/dynamic_graph/script_shortcuts.py b/src/dynamic_graph/script_shortcuts.py
index 099e97436d1f352b9c9ecaaef8c94f98df31e7d1..deeddcfe737266cc167f33459ce05443b6783232 100644
--- a/src/dynamic_graph/script_shortcuts.py
+++ b/src/dynamic_graph/script_shortcuts.py
@@ -53,11 +53,11 @@ def sigRepr( self ):
 
 def sigCall( sig,iter ):
     sig.recompute(iter)
-    print sigRepr(sig)
+    print(sigRepr(sig))
 
 def sigTimeIncr( sig,iter ):
     sig.recompute(sig.time+iter)
-    print sigRepr(sig)
+    print(sigRepr(sig))
 
 setattr(SignalBase,'__repr__',sigRepr)
 setattr(SignalBase,'__call__',sigCall)