Skip to content

Commit

Permalink
Better handling of bytecode errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky committed Oct 28, 2021
1 parent 9cf345d commit 32c4b84
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions uncompyle6/bin/uncompile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#
from __future__ import print_function
import sys, os, getopt, time
from xdis.version_info import version_tuple_to_str

program = 'uncompyle6'

Expand Down Expand Up @@ -76,8 +77,10 @@ def main_bin():
(3, 4), (3, 5), (3, 6),
(3, 7), (3, 8), (3, 9), (3, 10)
)):
print('Error: %s requires Python 2.4-3.10' % program,
file=sys.stderr)
print(
f"Error: {program} can decompile only bytecode from Python 3.7"
f""" to 3.8.\n\tYou have version: {version_tuple_to_str()}."""
)
sys.exit(-1)

do_verify = recurse_dirs = False
Expand Down Expand Up @@ -197,6 +200,9 @@ def main_bin():
mess = status_msg(do_verify, *result)
print('# ' + mess)
pass
except ImportError as e:
print(str(e))
sys.exit(2)
except (KeyboardInterrupt):
pass
except verify.VerifyCmpError:
Expand Down

0 comments on commit 32c4b84

Please sign in to comment.