Changeset 1558 for trunk/GSASIIpath.py
- Timestamp:
- Nov 2, 2014 10:11:53 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIpath.py
r1557 r1558 13 13 Other routines will update GSASII from the subversion server if svn can be 14 14 found. 15 16 Accesses configuration options, as defined in config.py 15 17 ''' 16 18 … … 307 309 sys.exit() 308 310 311 def IPyBreak(): 312 '''A routine that invokes an IPython session at the calling location 313 This routine is only used when debug=True is set in config.py 314 ''' 315 savehook = sys.excepthook # save the exception hook 316 from IPython.terminal.embed import InteractiveShellEmbed 317 import inspect 318 ipshell = InteractiveShellEmbed() 319 320 frame = inspect.currentframe().f_back 321 msg = 'Entering IPython console inside {0.f_code.co_filename} at line {0.f_lineno}'.format(frame) 322 ipshell(msg,stack_depth=2) # Go up one level, to see the calling routine 323 sys.excepthook = savehook # reset IPython's change to the exception hook 324 325 def exceptHook(*args): 326 '''A routine to be called when an exception occurs. It prints the traceback 327 with fancy formatting and then calls an IPython shell with the environment 328 of the exception location. 329 330 This routine is only used when debug=True is set in config.py 331 ''' 332 from IPython.core import ultratb 333 ultratb.FormattedTB(call_pdb=False,color_scheme='LightBG')(*args) 334 from IPython.terminal.embed import InteractiveShellEmbed 335 import inspect 336 frame = inspect.getinnerframes(args[2])[-1][0] 337 msg = 'Entering IPython console at {0.f_code.co_filename} at line {0.f_lineno}'.format(frame) 338 InteractiveShellEmbed(banner1=msg)(local_ns=frame.f_locals,global_ns=frame.f_globals) 339 340 def DoNothing(): 341 '''A routine that does nothing. This is called in place of IPyBreak and pdbBreak 342 except when the debug option is set True in config.py 343 ''' 344 pass 345 346 if GetConfigValue('debug'): 347 print 'Debug on: IPython: Exceptions and G2path.IPyBreak(); pdb: G2path.pdbBreak()' 348 sys.excepthook = exceptHook 349 import pdb 350 pdbBreak = pdb.set_trace 351 else: 352 IPyBreak = DoNothing 353 pdbBreak = DoNothing 354 309 355 if __name__ == '__main__': 310 356 import subprocess
Note: See TracChangeset
for help on using the changeset viewer.