|
| 1 | +from __future__ import print_function |
| 2 | + |
| 3 | + |
1 | 4 | ''' |
2 | 5 | Copyright (c) 1999 John Aycock |
3 | 6 | Copyright (c) 2000 by hartmut Goebel <h.goebel@crazy-compilers.com> |
@@ -68,9 +71,9 @@ def _load_module(filename): |
68 | 71 | try: |
69 | 72 | version = float(magics.versions[magic]) |
70 | 73 | except KeyError: |
71 | | - raise ImportError, "Unknown magic number %s in %s" % (ord(magic[0])+256*ord(magic[1]), filename) |
| 74 | + raise ImportError("Unknown magic number %s in %s" % (ord(magic[0])+256*ord(magic[1]), filename)) |
72 | 75 | if (version > 2.7) or (version < 2.5): |
73 | | - raise ImportError, "This is a Python %s file! Only Python 2.5 to 2.7 files are supported." % version |
| 76 | + raise ImportError("This is a Python %s file! Only Python 2.5 to 2.7 files are supported." % version) |
74 | 77 | #print version |
75 | 78 | fp.read(4) # timestamp |
76 | 79 | co = dis.marshalLoad(fp) |
@@ -105,7 +108,7 @@ def uncompyle(version, co, out=None, showasm=0, showast=0): |
105 | 108 | walk = walker.Walker(out, scanner, showast=showast) |
106 | 109 | try: |
107 | 110 | ast = walk.build_ast(tokens, customize) |
108 | | - except walker.ParserError, e : # parser failed, dump disassembly |
| 111 | + except walker.ParserError as e : # parser failed, dump disassembly |
109 | 112 | print >>__real_out, e |
110 | 113 | raise |
111 | 114 | del tokens # save memory |
@@ -223,17 +226,17 @@ def _get_outstream(outfile): |
223 | 226 | if do_verify: |
224 | 227 | try: |
225 | 228 | verify.compare_code_with_srcfile(infile, outfile) |
226 | | - if not outfile: print '\n# okay decompyling', infile, __memUsage() |
| 229 | + if not outfile: print('\n# okay decompyling', infile, __memUsage()) |
227 | 230 | okay_files += 1 |
228 | | - except verify.VerifyCmpError, e: |
| 231 | + except verify.VerifyCmpError as e: |
229 | 232 | verify_failed_files += 1 |
230 | 233 | os.rename(outfile, outfile + '_unverified') |
231 | 234 | if not outfile: |
232 | 235 | print >>sys.stderr, "### Error Verifiying", file |
233 | 236 | print >>sys.stderr, e |
234 | 237 | else: |
235 | 238 | okay_files += 1 |
236 | | - if not outfile: print '\n# okay decompyling', infile, __memUsage() |
| 239 | + if not outfile: print('\n# okay decompyling', infile, __memUsage()) |
237 | 240 | if outfile: |
238 | 241 | sys.stdout.write("decompiled %i files: %i okay, %i failed, %i verify failed\r" % (tot_files, okay_files, failed_files, verify_failed_files)) |
239 | 242 | sys.stdout.flush() |
|
0 commit comments