diff --git a/dune/fufem/test/dunepythontest.cc b/dune/fufem/test/dunepythontest.cc index 86798acf8b7914d32c9c8b782a754f388e878824..e05c69cf355f946599050a0ae22705b9be6f3635 100644 --- a/dune/fufem/test/dunepythontest.cc +++ b/dune/fufem/test/dunepythontest.cc @@ -60,7 +60,7 @@ int main(int argc, char** argv) std::cout << std::endl; std::cout << "Example 1: Execute a single line of python code *******************************" << std::endl; { - pyMain.run("print 'Hello world!'"); + pyMain.run("print('Hello world!')"); } @@ -75,7 +75,7 @@ int main(int argc, char** argv) << std::endl << " def __init__(self, s):" << std::endl << " self.s=s" << std::endl << " def f(self):" - << std::endl << " print self.s" + << std::endl << " print(self.s)" << std::endl << "" << std::endl << "a=A('Hello world!')" << std::endl << "a.f()"; @@ -202,7 +202,7 @@ int main(int argc, char** argv) << std::endl << "try:" << std::endl << " import mymodule" << std::endl << "except:" - << std::endl << " print 'mymodule was not found!'" + << std::endl << " print('mymodule was not found!')" << std::endl; // Create a new module not contained in a file @@ -219,11 +219,11 @@ int main(int argc, char** argv) // Now we can import the new module into other module, e.g., main // using its name. pyMain.import("mymodule"); - pyMain.run("print mymodule.f(mymodule.a, mymodule.b)"); + pyMain.run("print(mymodule.f(mymodule.a, mymodule.b))"); // You can also import a Module by giving another name. pyMain.importAs(myModule, "mymodule2"); - pyMain.run("print mymodule2.f(mymodule.a, mymodule.b)"); + pyMain.run("print(mymodule2.f(mymodule.a, mymodule.b))"); } @@ -275,7 +275,7 @@ int main(int argc, char** argv) pyMain.set("result", Python::evaluate("2+3")); // Now the name 'result' in __main__ holds a reference to the new result object. - pyMain.run("print result"); + pyMain.run("print(result)"); } @@ -461,7 +461,7 @@ int main(int argc, char** argv) pyMain.set("v", v); // Let python print the content of the list. - pyMain.run("print v"); + pyMain.run("print(v)"); } @@ -515,7 +515,7 @@ int main(int argc, char** argv) // You can now also call the function in python directly... std::cout << "Result of evaluating the created function g in python directly: "; - pyMain.run("print g(2)"); + pyMain.run("print(g(2))"); // ... or by calling it manually. std::cout << "Result of evaluating the created function g in python manually through the C++ interface: ";