Browse Source

warning, not error, if a module named in toon.dc doesn't exist.

David Rose 22 years ago
parent
commit
34d313acb6

+ 4 - 1
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):

+ 1 - 1
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 +

+ 2 - 0
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