mailr22771 - in /trunk: lib/errors.py relax.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on April 15, 2014 - 16:40:
Author: bugman
Date: Tue Apr 15 16:40:19 2014
New Revision: 22771

URL: http://svn.gna.org/viewcvs/relax?rev=22771&view=rev
Log:
Created the '--error-state' command line option for saving a pickled state 
when a RelaxError is raised.

This gives greater control of a powerful feature added to relax by Chris 
MacRaild.  The pickled
state can then be attached to bug reports or can be used to quickly load the 
state prior to failure
when in the scripting UI mode.


Modified:
    trunk/lib/errors.py
    trunk/relax.py

Modified: trunk/lib/errors.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/errors.py?rev=22771&r1=22770&r2=22771&view=diff
==============================================================================
--- trunk/lib/errors.py (original)
+++ trunk/lib/errors.py Tue Apr 15 16:40:19 2014
@@ -40,7 +40,7 @@
 
 
 # Module variables for changing the behaviour of the warning system.
-ESCALATE = False    # If True, warnings will be converted into errors.
+SAVE_ERROR_STATE = False    # If True, then a pickled state file will be 
saved when a RelaxError occurs.
 
 # Text variables.
 BIN = 'a binary number (0 or 1)'
@@ -136,7 +136,7 @@
         """Modify the behaviour of the error system."""
 
         # Save the state if the escalate flag is turned on.
-        if ESCALATE:
+        if SAVE_ERROR_STATE:
             save_state()
 
         # Modify the error message to include 'RelaxError' at the start 
(using coloured text if a TTY).

Modified: trunk/relax.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/relax.py?rev=22771&r1=22770&r2=22771&view=diff
==============================================================================
--- trunk/relax.py      (original)
+++ trunk/relax.py      Tue Apr 15 16:40:19 2014
@@ -310,6 +310,7 @@
         group.add_option('-e', '--escalate', action='store_true', 
dest='escalate', default=0, help='escalate all warnings to errors')
         group.add_option('-r', '--traceback', action='store_true', 
dest='traceback', default=0, help='show stack tracebacks on all RelaxErrors 
and RelaxWarnings')
         group.add_option('--numpy-raise', action='store_true', 
dest='numpy_raise', default=0, help='convert numpy warnings to errors')
+        group.add_option('--error-state', action='store_true', 
dest='error_state', default=0, help='save a pickled state file when a 
RelaxError occurs')
         parser.add_option_group(group)
 
         # Parse the options.
@@ -321,12 +322,13 @@
             lib.warnings.TRACEBACK = True
         if options.escalate:
             lib.warnings.ESCALATE = True
-            lib.errors.ESCALATE = True
         if options.traceback:
             status.traceback = True
             lib.warnings.TRACEBACK = True
         if options.numpy_raise:
             numpy.seterr(all='raise')
+        if options.error_state:
+            lib.errors.SAVE_ERROR_STATE = True
 
         # Script prompt interactive inspection flag.
         if options.prompt:




Related Messages


Powered by MHonArc, Updated Tue Apr 15 17:00:02 2014