From 34d313acb6a560e02220019ed1abdd3b5b022c5d Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 2 Jul 2003 04:10:49 +0000 Subject: [PATCH] warning, not error, if a module named in toon.dc doesn't exist. --- direct/src/distributed/ClientDistClass.py | 5 ++++- direct/src/distributed/ClientDistUpdate.py | 2 +- direct/src/distributed/ClientRepository.py | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/direct/src/distributed/ClientDistClass.py b/direct/src/distributed/ClientDistClass.py index d23cd54382..49e57acf7e 100644 --- a/direct/src/distributed/ClientDistClass.py +++ b/direct/src/distributed/ClientDistClass.py @@ -21,8 +21,11 @@ class ClientDistClass: exec("import " + self.name) self.constructor = eval(self.name + "." + self.name) except ImportError, e: - self.notify.warning("%s.py does not exist." % (self.name)) + self.notify.warning("Unable to import %s.py: %s" % (self.name, e)) self.constructor = None + except (NameError, AttributeError), e: + self.notify.warning("%s.%s does not exist: %s" % (self.name, self.name, e)) + self.constructor = None return None def parseFields(self, dcClass): diff --git a/direct/src/distributed/ClientDistUpdate.py b/direct/src/distributed/ClientDistUpdate.py index a254ff4e96..da1f5d3606 100644 --- a/direct/src/distributed/ClientDistUpdate.py +++ b/direct/src/distributed/ClientDistUpdate.py @@ -28,7 +28,7 @@ class ClientDistUpdate: # Only catch name and attribute errors # as all other errors are legit errors except ImportError, e: - self.notify.warning("%s.py does not exist." % (cdc.name)) + self.notify.warning("Unable to import %s.py: %s" % (cdc.name, e)) self.func = None except (NameError, AttributeError), e: #self.notify.warning(cdc.name + "." + self.name + diff --git a/direct/src/distributed/ClientRepository.py b/direct/src/distributed/ClientRepository.py index 69d770e324..7a57376594 100644 --- a/direct/src/distributed/ClientRepository.py +++ b/direct/src/distributed/ClientRepository.py @@ -431,6 +431,8 @@ class ClientRepository(DirectObject.DirectObject): # If it is not in the dictionary or the cache, then... else: # Construct a new one + if cdc.constructor == None: + self.notify.error("Could not create an undefined %s object." % (cdc.name)) distObj = cdc.constructor(self) # Assign it an Id distObj.doId = doId