Commit b7d3e65b authored by Guido van Rossum's avatar Guido van Rossum

Improve error handling; don't die from unicode errors or syntax errors.

parent 8ac004e6
...@@ -67,11 +67,17 @@ def compile_dir(dir, maxlevels=10, ddir=None, ...@@ -67,11 +67,17 @@ def compile_dir(dir, maxlevels=10, ddir=None,
raise KeyboardInterrupt raise KeyboardInterrupt
except py_compile.PyCompileError as err: except py_compile.PyCompileError as err:
if quiet: if quiet:
print('Compiling', fullname, '...') print('*** Error compiling', fullname, '...')
else:
print('*** ', end='')
print(err.msg) print(err.msg)
success = 0 success = 0
except IOError as e: except (SyntaxError, UnicodeError, IOError) as e:
print("Sorry", e) if quiet:
print('*** Error compiling', fullname, '...')
else:
print('*** ', end='')
print(e.__class__.__name__ + ':', e)
success = 0 success = 0
else: else:
if ok == 0: if ok == 0:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment