Browse Source

pdb is not published, don't crash in production

Darren Ranalli 18 years ago
parent
commit
12d0fc68c0
1 changed files with 11 additions and 3 deletions
  1. 11 3
      direct/src/showbase/PythonUtil.py

+ 11 - 3
direct/src/showbase/PythonUtil.py

@@ -2187,9 +2187,17 @@ def appendStr(obj, st):
     appendedStr = None
     appendedStr = None
     return obj
     return obj
 
 
-import pdb
-setTrace = pdb.set_trace
-pm = pdb.pm
+# convenience shortcuts for __dev__ debugging
+# we don't have the __dev__ flag at this point
+try:
+    import pdb
+    setTrace = pdb.set_trace
+    pm = pdb.pm
+except:
+    # we're in production, there is no pdb module. assign these to something so that the
+    # __builtin__ exports will work
+    setTrace = None
+    pm = None
 
 
 class ScratchPad:
 class ScratchPad:
     """empty class to stick values onto"""
     """empty class to stick values onto"""