functions, you may want to use the getmod() function in this module.
"""
-import os, threading, types, getopt
+import sys, os, threading, types, logging, getopt
import wsgiutil
__all__ = ["application", "wmain", "getmod", "cachedmod", "chain"]
+log = logging.getLogger("wsgidir")
+
class cachedmod(object):
"""Cache entry for modules loaded by getmod()
object.
"""
path = env["SCRIPT_FILENAME"]
- mod = getmod(path)
+ try:
+ mod = getmod(path)
+ except Exception:
+ log.error("Exception occurred when loading %s" % path, exc_info=sys.exc_info())
+ return wsgiutil.simpleerror(env, startreq, 500, "Internal Error", "Could not load WSGI handler.")
entry = None
if mod is not None:
mod.lock.acquire()
functions, you may want to use the getmod() function in this module.
"""
-import os, threading, types, importlib, getopt
+import sys, os, threading, types, logging, importlib, getopt
from . import wsgiutil
__all__ = ["application", "wmain", "getmod", "cachedmod", "chain"]
+log = logging.getLogger("wsgidir")
+
class cachedmod(object):
"""Cache entry for modules loaded by getmod()
object.
"""
path = env["SCRIPT_FILENAME"]
- mod = getmod(path)
+ try:
+ mod = getmod(path)
+ except Exception:
+ log.error("Exception occurred when loading %s" % path, exc_info=sys.exc_info())
+ return wsgiutil.simpleerror(env, startreq, 500, "Internal Error", "Could not load WSGI handler.")
entry = None
if mod is not None:
with mod.lock: