diff --git a/python/dune/perftool/compile.py b/python/dune/perftool/compile.py
index 627eec43b223c2941ba198411fab387a1a7ac05d..6439ef51a4d628badd5215e7f7bda82f6af1a2f2 100644
--- a/python/dune/perftool/compile.py
+++ b/python/dune/perftool/compile.py
@@ -19,13 +19,14 @@ def read_ufl(uflfile):
     uflcode = read_ufl_file(uflfile)
     namespace = {}
     try:
-        exec "from dune.perftool.ufl.execution import *\n" + uflcode in namespace
+        namespace = globals()
+        exec("from dune.perftool.ufl.execution import *\n" + uflcode, namespace)
     except:
         import os
         basename = os.path.splitext(os.path.basename(uflfile))[0]
         basename = "{}_debug".format(basename)
         pyname = "{}.py".format(basename)
-        print pyname
+        print(pyname)
         pycode = "#!/usr/bin/env python\nfrom dune.perftool.ufl.execution import *\nset_level(DEBUG)\n" + uflcode
         with file(pyname, "w") as f:
             f.write(pycode)
diff --git a/python/dune/perftool/loopy/target.py b/python/dune/perftool/loopy/target.py
index 41cb9a7c10aaa226958713a0d56db7bd70bcf2fb..36110ff2cfd53ee94155cadb73955fcdc54c30a1 100644
--- a/python/dune/perftool/loopy/target.py
+++ b/python/dune/perftool/loopy/target.py
@@ -8,7 +8,8 @@ from loopy.target.c.codegen.expression import ExpressionToCMapper
 _registry = {'float32': 'float',
              'int32': 'int',
              'float64': 'double',
-             'string': 'std::string'}
+             'string': 'std::string',
+             'str': 'std::string'}
 
 
 class MyMapper(ExpressionToCMapper):
diff --git a/python/dune/perftool/pdelab/localoperator.py b/python/dune/perftool/pdelab/localoperator.py
index 2795d33094715fa5976099214d93e386701a23be..e926b4a8a12d83c2761d79534736ce435c4708b1 100644
--- a/python/dune/perftool/pdelab/localoperator.py
+++ b/python/dune/perftool/pdelab/localoperator.py
@@ -270,7 +270,7 @@ def generate_kernel(integrals):
             iname, within = next(get_iname_duplication_options(kernel))
 
         # Do the transformation
-        print "Applying iname duplication to measure {}: iname {}; within {}".format(measure, iname, within)
+        print("Applying iname duplication to measure {}: iname {}; within {}".format(measure, iname, within))
         kernel = duplicate_inames(kernel, iname, within)
 
     # Loopy might have introduced some temporary variables during preprocessing. As I want to have my own
diff --git a/python/dune/perftool/ufl/transformations/extract_accumulation_terms.py b/python/dune/perftool/ufl/transformations/extract_accumulation_terms.py
index d1c18d9923acee26db1df858b60458acacacf019..94413d1a6fdbcc3abf1d5139e851454426e6b6f3 100644
--- a/python/dune/perftool/ufl/transformations/extract_accumulation_terms.py
+++ b/python/dune/perftool/ufl/transformations/extract_accumulation_terms.py
@@ -31,7 +31,7 @@ def split_into_accumulation_terms(expr):
     accumulation_terms = []
 
     # Treat the case of a rank 1 form:
-    if len(filter(lambda ma: ma.argexpr.number() == 1, mod_args)) == 0:
+    if len(list(filter(lambda ma: ma.argexpr.number() == 1, mod_args))) == 0:
         for arg in mod_args:
             # Do the replacement on the expression
             accumulation_terms.append(replace_expression(expr,
diff --git a/python/dune/perftool/ufl/transformations/reindexing.py b/python/dune/perftool/ufl/transformations/reindexing.py
index 16cc9163530366a812875f3bb9100a5eb0191c20..2329462d94b860fbac3d9dbb38b772745b16d81e 100644
--- a/python/dune/perftool/ufl/transformations/reindexing.py
+++ b/python/dune/perftool/ufl/transformations/reindexing.py
@@ -31,8 +31,7 @@ class IndexedMapper(MultiFunction):
         tensor, idx = o.ufl_operands
 
         # Extract an index mapping
-        from itertools import izip
-        for inner, outer in izip(idx, self.indexed_expr.ufl_operands[1]):
+        for inner, outer in zip(idx, self.indexed_expr.ufl_operands[1]):
             self.rim.replacement_map[inner] = self.rim.replacement_map.setdefault(outer, outer)
 
         # And return an expression with the component tensor removed