diff options
author | Guido van Rossum <guido@python.org> | 2007-07-15 13:01:48 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-07-15 13:01:48 +0000 |
commit | 0723c6104d770a33421e79f1179532ce53164b5e (patch) | |
tree | 28739852b73420f2469c02a25b83fd624389a080 /Lib | |
parent | 66cbd34034387cf5f70e0c0b9cd68a31c39f3d94 (diff) | |
download | cpython-0723c6104d770a33421e79f1179532ce53164b5e.tar.gz |
Improve error handling; don't die from unicode errors or syntax errors.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/compileall.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Lib/compileall.py b/Lib/compileall.py index 6781908653..6300776a48 100644 --- a/Lib/compileall.py +++ b/Lib/compileall.py @@ -67,11 +67,17 @@ def compile_dir(dir, maxlevels=10, ddir=None, raise KeyboardInterrupt except py_compile.PyCompileError as err: if quiet: - print('Compiling', fullname, '...') + print('*** Error compiling', fullname, '...') + else: + print('*** ', end='') print(err.msg) success = 0 - except IOError as e: - print("Sorry", e) + except (SyntaxError, UnicodeError, IOError) as e: + if quiet: + print('*** Error compiling', fullname, '...') + else: + print('*** ', end='') + print(e.__class__.__name__ + ':', e) success = 0 else: if ok == 0: |