]> granicus.if.org Git - python/commitdiff
Improve error handling; don't die from unicode errors or syntax errors.
authorGuido van Rossum <guido@python.org>
Sun, 15 Jul 2007 13:01:48 +0000 (13:01 +0000)
committerGuido van Rossum <guido@python.org>
Sun, 15 Jul 2007 13:01:48 +0000 (13:01 +0000)
Lib/compileall.py

index 6781908653b5dd92b4525aacadad72bb528faa2f..6300776a48701ad6102d718b8d679fe6e2a89086 100644 (file)
@@ -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: