Catch more exceptions at top level.
authorMatthijs Kooijman <matthijs@stdin.nl>
Wed, 12 Aug 2009 18:58:56 +0000 (20:58 +0200)
committerMatthijs Kooijman <matthijs@stdin.nl>
Thu, 13 Aug 2009 09:58:42 +0000 (11:58 +0200)
Previously, a bunch of intialization code was outside of the try,
so any exceptions there would not be shown at all.

src/main.py

index 85065dd9d0721cc481033fea15ec75a2c7dfecef..c278d4e785fb09c989b7a3d0fd728d668c9c7da7 100644 (file)
@@ -7,33 +7,34 @@
 #tr.go()
 
 def run():
-    import sys
-    import e32
-    if e32.in_emulator():
-        sys.path.append('c:/python/')
+    try:
+        import sys
+        import e32
+        if e32.in_emulator():
+            sys.path.append('c:/python/')
+            
+            
+        import os.path
+        print sys.path
+    #    print os.path.dirname(__file__)
+    #    sys.path.append(os.path.dirname(__file__))
+        import log.logging
+        from log.logging import logger
+        import sys,os
+        logger.log_stderr()
+        sys.stderr.write('stderr logged from default')
         
         
-    import os.path
-    print sys.path
-#    print os.path.dirname(__file__)
-#    sys.path.append(os.path.dirname(__file__))
-    import log.logging
-    from log.logging import logger
-    import sys,os
-    logger.log_stderr()
-    sys.stderr.write('stderr logged from default')
-    
-    
-    
-    lock=None
-    
-    from config.config import gtd_directory,read_configurations
-    read_configurations()
+        
+        lock=None
+        
+        from config.config import gtd_directory,read_configurations
+        read_configurations()
 
-    from inout.io import safe_chdir
-    safe_chdir(gtd_directory)
-    print os.getcwd() 
-    try:
+        from inout.io import safe_chdir
+        safe_chdir(gtd_directory)
+        print os.getcwd() 
+        
         e32.ao_yield()
         import sys,os