Author: echuck
Date: 2005-03-11 19:47:19 -0700 (Fri, 11 Mar 2005)
New Revision: 2089
Modified:
Webware/trunk/WebKit/URLParser.py
Log:
addContext() catches ImportError. It now also catches TypeError since that can be raised when the context dir does not exist at all.
Modified: Webware/trunk/WebKit/URLParser.py
===================================================================
--- Webware/trunk/WebKit/URLParser.py 2005-03-12 02:45:59 UTC (rev 2088)
+++ Webware/trunk/WebKit/URLParser.py 2005-03-12 02:47:19 UTC (rev 2089)
@@ -180,6 +180,7 @@
print 'Default context aliases to: %s' % (dest)
return
+ e = None
try:
importAsName = name
localDir, packageName = os.path.split(dir)
@@ -191,8 +192,11 @@
raise ImportError, '__init__.py could not be found'
mod = imp.load_module(name, *res)
except ImportError, e:
- print 'Error loading context: %s: %s: dir=%s' \
- % (name, e, dir)
+ pass
+ except TypeError, e: # TypeError can be raised by imp.load_module() when context path does not exist
+ pass
+ if e:
+ print 'Error loading context: %s: %s: dir=%s' % (name, e, dir)
return
if hasattr(mod, 'contextInitialize'):
|