From 5fbe3ce3e4acf0a5be08e555c5e5c67243361ca5 Mon Sep 17 00:00:00 2001 From: "mhammond%skippinet.com.au" Date: Tue, 6 Jun 2006 07:05:44 +0000 Subject: [PATCH] Handle that 'print' statements may fail in a release build. git-svn-id: svn://10.0.0.236/trunk@199090 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/extensions/python/xpcom/server/module.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/mozilla/extensions/python/xpcom/server/module.py b/mozilla/extensions/python/xpcom/server/module.py index 73318f5b971..1900d64009d 100644 --- a/mozilla/extensions/python/xpcom/server/module.py +++ b/mozilla/extensions/python/xpcom/server/module.py @@ -67,7 +67,10 @@ class Module: fname = os.path.basename(location.path) for klass in self.components.values(): reg_contractid = klass._reg_contractid_ - print "Registering '%s' (%s)" % (reg_contractid, fname) + try: + print "Registering '%s' (%s)" % (reg_contractid, fname) + except IOError: + pass # stdout may not be valid for windows apps! reg_desc = getattr(klass, "_reg_desc_", reg_contractid) compMgr = compMgr.queryInterface(components.interfaces.nsIComponentRegistrar) compMgr.registerFactoryLocation(klass._reg_clsid_, @@ -97,10 +100,13 @@ class Module: extra_func(klass, compMgr, location, loaderStr) except Exception: ok = 0 - if ok: - print "Successfully unregistered", klass.__name__ - else: - print "Unregistration of", klass.__name__, "failed (not previously registered?)" + try: + if ok: + print "Successfully unregistered", klass.__name__ + else: + print "Unregistration of", klass.__name__, "failed (not previously registered?)" + except IOError: + pass def canUnload(self, compMgr): # single bool result