← Back to team overview

yade-dev team mailing list archive

[svn] r1472 - eudoxos

 

------------------------------------------------------------------------
r1472 | eudoxos | 2008-08-18 21:23:50 +0200 (pon, 18 sie 2008) | 2 lines
Changed paths:
   M /trunk/core/yade.cpp
   M /trunk/gui/py/PythonUI_rc.py

1. Do not propagate exception to c++ (-> crash) if there is python exception in the script being run from command-line. Just print traceback and drop to the python console (unless stop after execution specified).

------------------------------------------------------------------------
Index: gui/py/PythonUI_rc.py
===================================================================
--- gui/py/PythonUI_rc.py	(revision 1471)
+++ gui/py/PythonUI_rc.py	(revision 1472)
@@ -28,7 +28,11 @@
 ## run script if requested from the command line
 if runtime.script:
 	print "Running script "+runtime.script
-	execfile(runtime.script)
+	# an exception from python would propagate to c++ unhandled and cause crash
+	try: execfile(runtime.script)
+	except: 
+		import traceback
+		traceback.print_exc()
 if runtime.stopAfter: sys.exit(0)
 
 # run commands if requested from the command line
Index: core/yade.cpp
===================================================================
--- core/yade.cpp	(revision 1471)
+++ core/yade.cpp	(revision 1472)
@@ -168,12 +168,12 @@
 		// read logging configuration from file and watch it (creates a separate thread)
 		std::string logConf=configPath+"/logging.conf";
 		if(filesystem::exists(logConf)){
+			LOG_INFO("Loading  "<<logConf);
 			log4cxx::PropertyConfigurator::configure(logConf);
-			LOG_INFO("Loaded  "<<logConf);
 		} else { // otherwise use simple console-directed logging
 			log4cxx::BasicConfigurator::configure();
 			logger->setLevel(log4cxx::Level::WARN);
-			LOG_INFO("Logger uses basic (console) configuration since `"<<logConf<<"' was not found. INFO and DEBUG messages will be ommited.");
+			LOG_INFO("Logger uses basic (console) configuration since `"<<logConf<<"' was not found. INFO and DEBUG messages will be omitted.");
 			LOG_INFO("Look at the file doc/logging.conf.sample in the source distribution as an example on how to customize logging.");
 		}
 	#endif