--- a/converters/hotshot2calltree.in
+++ b/converters/hotshot2calltree.in
@@ -147,8 +147,8 @@
         if (file_limit > 0) and (filecount > file_limit):
             break
     
-    print
-    print "total_cost: % d Ticks",total_cost
+    print()
+    print("total_cost: % d Ticks",total_cost)
     dumpResults(output, call_dict, total_cost, cost_per_pos, cost_per_function)
 
 def convertHandleFilename(inputfilename, caller_stack, call_dict, cost_per_pos, cost_per_function, filecount):
@@ -234,9 +234,9 @@
             return_from_call(caller_stack, call_dict, total_cost)
 
     except IOError:
-        print "could not open inputfile '%s', ignore this." % inputfilename
-    except EOFError, m:
-        print "EOF: %s" % (m,)
+        print("could not open inputfile '%s', ignore this." % inputfilename)
+    except EOFError as m:
+        print("EOF: %s" % (m,))
     return total_cost
 
 def pretty_name(file, function):
@@ -252,7 +252,7 @@
         self.last_values = {}
 
     def clearTag(self, tag):
-        if self.last_values.has_key(tag):
+        if tag in self.last_values.keys():
             del self.last_values[ tag ]
     def clear(self):
         self.last_values = {}
@@ -316,16 +316,16 @@
 def run_without_optparse():
     """parse the options without optparse, use sys.argv"""
     if  len(sys.argv) < 4 or sys.argv[1] != "-o" :
-        print "usage: hotshot2cachegrind -o outputfile in1 [in2 [in3 [...]]]"
+        print("usage: hotshot2cachegrind -o outputfile in1 [in2 [in3 [...]]]")
         return
     outputfilename = sys.argv[2]
     try:
-        output = file(outputfilename, "w")
+        output = open(outputfilename, "w")
         args = sys.argv[3:]
         convertProfFiles(output, args)
         output.close()
     except IOError:
-        print "could not open '%s' for writing." % outputfilename
+        print("could not open '%s' for writing." % outputfilename)
 
 def run_with_optparse():
     """parse the options with optparse"""
@@ -346,10 +346,10 @@
     file_limit = int(options.file_limit)
     try:
         if options.outputfilename and options.outputfilename != "-":
-            output = file(options.outputfilename, "w")
+            output = open(options.outputfilename, "w")
             close_output = 1
     except IOError:
-        print "could not open '%s' for writing." % options.outputfilename
+        print("could not open '%s' for writing." % options.outputfilename)
     if output:
         convertProfFiles(output, args)
         if close_output:
@@ -364,7 +364,7 @@
         prof.runcall(run)
         prof.close()
     else:
-        print "not profiling myself, since '%s' exists, running normal" % filename
+        print("not profiling myself, since '%s' exists, running normal" % filename)
         run()
 
 # check if optparse is available.
