[pypy-commit] pypy default: Be resistent against a random "pygame" module without "pygame.error"

arigo noreply at buildbot.pypy.org
Sat Apr 26 10:08:09 CEST 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r71000:106784259a88
Date: 2014-04-26 10:07 +0200
http://bitbucket.org/pypy/pypy/changeset/106784259a88/

Log:	Be resistent against a random "pygame" module without "pygame.error"

diff --git a/dotviewer/graphserver.py b/dotviewer/graphserver.py
--- a/dotviewer/graphserver.py
+++ b/dotviewer/graphserver.py
@@ -160,15 +160,14 @@
                     " | instructions in dotviewer/sshgraphserver.py\n")
             try:
                 import pygame
-            except ImportError:
+                if isinstance(e, pygame.error):
+                    print >> f, help
+            except Exception, e:
                 f.seek(0)
                 f.truncate()
-                print >> f, "ImportError"
+                print >> f, "%s: %s" % (e.__class__.__name__, e)
                 print >> f, " | Pygame is not installed; either install it, or"
                 print >> f, help
-            else:
-                if isinstance(e, pygame.error):
-                    print >> f, help
             io.sendmsg(msgstruct.MSG_ERROR, f.getvalue())
     else:
         listen_server(sys.argv[1])


More information about the pypy-commit mailing list