##// END OF EJS Templates
Protect against absent global IPython instance....
Fernando Perez -
Show More
@@ -267,9 +267,10 b' def _formatTracebackLines(lnum, index, lines, Colors, lvals=None,scheme=None):'
267 267
268 268 # This lets us get fully syntax-highlighted tracebacks.
269 269 if scheme is None:
270 try:
271 scheme = ipapi.get().IP.rc.colors
272 except:
270 ipinst = ipapi.get()
271 if ipinst is not None:
272 scheme = ipinst.IP.rc.colors
273 else:
273 274 scheme = DEFAULT_SCHEME
274 275 _line_format = _parser.format2
275 276
@@ -489,7 +490,9 b' class ListTB(TBTools):'
489 490
490 491 # vds:>>
491 492 if have_filedata:
492 ipapi.get().IP.hooks.synchronize_with_editor(filename, lineno, 0)
493 ipinst = ipapi.get()
494 if ipinst is not None:
495 ipinst.IP.hooks.synchronize_with_editor(filename, lineno, 0)
493 496 # vds:<<
494 497
495 498 return list
@@ -809,7 +812,9 b' class VerboseTB(TBTools):'
809 812 filepath, lnum = records[-1][1:3]
810 813 #print "file:", str(file), "linenb", str(lnum) # dbg
811 814 filepath = os.path.abspath(filepath)
812 ipapi.get().IP.hooks.synchronize_with_editor(filepath, lnum, 0)
815 ipinst = ipapi.get()
816 if ipinst is not None:
817 ipinst.IP.hooks.synchronize_with_editor(filepath, lnum, 0)
813 818 # vds: <<
814 819
815 820 # return all our info assembled as a single string
@@ -267,9 +267,10 b' def _formatTracebackLines(lnum, index, lines, Colors, lvals=None,scheme=None):'
267 267
268 268 # This lets us get fully syntax-highlighted tracebacks.
269 269 if scheme is None:
270 try:
271 scheme = ipapi.get().IP.rc.colors
272 except:
270 ipinst = ipapi.get()
271 if ipinst is not None:
272 scheme = ipinst.IP.rc.colors
273 else:
273 274 scheme = DEFAULT_SCHEME
274 275 _line_format = _parser.format2
275 276
@@ -489,7 +490,9 b' class ListTB(TBTools):'
489 490
490 491 # vds:>>
491 492 if have_filedata:
492 ipapi.get().IP.hooks.synchronize_with_editor(filename, lineno, 0)
493 ipinst = ipapi.get()
494 if ipinst is not None:
495 ipinst.IP.hooks.synchronize_with_editor(filename, lineno, 0)
493 496 # vds:<<
494 497
495 498 return list
@@ -809,7 +812,9 b' class VerboseTB(TBTools):'
809 812 filepath, lnum = records[-1][1:3]
810 813 #print "file:", str(file), "linenb", str(lnum) # dbg
811 814 filepath = os.path.abspath(filepath)
812 ipapi.get().IP.hooks.synchronize_with_editor(filepath, lnum, 0)
815 ipinst = ipapi.get()
816 if ipinst is not None:
817 ipinst.IP.hooks.synchronize_with_editor(filepath, lnum, 0)
813 818 # vds: <<
814 819
815 820 # return all our info assembled as a single string
General Comments 0
You need to be logged in to leave comments. Login now