james$ cat dict_ex.py h = { } print h.iterkeys().next() james$ ./refactor.py dict_ex.py Traceback (most recent call last): File "./refactor.py", line 475, in sys.exit(main()) File "./refactor.py", line 80, in main rt.refactor_args(args) File "./refactor.py", line 168, in refactor_args self.refactor_file(arg) File "./refactor.py", line 222, in refactor_file if self.refactor_tree(tree, filename): File "./refactor.py", line 262, in refactor_tree new = fixer.transform(node) File "/Users/james/Documents/py3k/subversion/2to3/fixes/fix_print.py", line 58, in transform l_args[0].set_prefix("") AttributeError: 'DelayedStrNode' object has no attribute 'set_prefix' james$ cat tup.py def parse_graminit_c(self, filename): try: f = open(filename) except IOError, err: print "Can't open %s: %s" % (filename, err) return False lineno = 0 lineno, line = lineno+1, f.next() james$ ./refactor.py tup.py Traceback (most recent call last): File "./refactor.py", line 475, in sys.exit(main()) File "./refactor.py", line 80, in main rt.refactor_args(args) File "./refactor.py", line 168, in refactor_args self.refactor_file(arg) File "./refactor.py", line 222, in refactor_file if self.refactor_tree(tree, filename): File "./refactor.py", line 262, in refactor_tree new = fixer.transform(node) File "/Users/james/Documents/py3k/subversion/2to3/fixes/fix_ws_comma.py", line 33, in transform prefix = child.get_prefix() AttributeError: 'DelayedStrNode' object has no attribute 'get_prefix' james$ cat no_tup.py def parse_graminit_c(self, filename): try: f = open(filename) except IOError, err: print "Can't open %s: %s" % (filename, err) return False lineno = 0 # lineno, line = lineno+1, f.next() james$ ./refactor.py no_tup.py --- no_tup.py (original) +++ no_tup.py (refactored) @@ -1,8 +1,8 @@ def parse_graminit_c(self, filename): try: f = open(filename) - except IOError, err: - print "Can't open %s: %s" % (filename, err) + except IOError as err: + print("Can't open %s: %s" % (filename, err)) return False lineno = 0 RefactoringTool: Files that need to be modified: RefactoringTool: no_tup.py james$