summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-07-15 13:01:48 (GMT)
committerGuido van Rossum <guido@python.org>2007-07-15 13:01:48 (GMT)
commitb7d3e65b3b59eb4970720241f4168b1a9deda974 (patch)
treeb898fc87ac777f32c91071ff7d83c886fa74ac72
parent8ac004e69895e8fd525307fdc1e093f92b15ce09 (diff)
downloadcpython-b7d3e65b3b59eb4970720241f4168b1a9deda974.zip
cpython-b7d3e65b3b59eb4970720241f4168b1a9deda974.tar.gz
cpython-b7d3e65b3b59eb4970720241f4168b1a9deda974.tar.bz2
Improve error handling; don't die from unicode errors or syntax errors.
-rw-r--r--Lib/compileall.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/Lib/compileall.py b/Lib/compileall.py
index 6781908..6300776 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: