Commits

Anonymous committed 18f0360

style cleanups

  • Participants
  • Parent commits 6ae8e2e

Comments (0)

Files changed (1)

         try:
             from google.appengine.api.mail_stub import subprocess
             sys.modules['subprocess'] = subprocess
-            try:
-                # subprocess in Python 2.5 on Linux and OS X uses the buffer()
-                # builtin which unfortunately gets removed by the GAE SDK, so
-                # we have to get it back with this ugly hack 
-                import inspect
-                sys.modules['subprocess'].buffer = inspect.currentframe().f_back.f_back.f_back.f_locals['old_builtin']['buffer']
-            except:
-                pass
-        except ImportError:
+            # subprocess in Python 2.5 on Linux and OS X uses the buffer()
+            # builtin which unfortunately gets removed by the GAE SDK, so
+            # we have to get it back with this ugly hack 
+            import inspect
+            frame = inspect.currentframe().f_back.f_back.f_back
+            old_builtin = frame.f_locals['old_builtin']
+            subprocess.buffer = old_builtin['buffer']
+        except Exception, e:
             import logging
-            logging.warn('Could not add the subprocess module to the sandbox.')
+            logging.warn('Could not add the subprocess module to the sandbox: %s' % e)
 
     os.environ.update(env_ext)