[TxMt] Bug Fix in sitecustomize.py in Python.tmbundle?

Jaremy Creechley creechley at gmail.com
Thu Feb 12 07:26:32 UTC 2009

The sitecustomize.py script in the Python.tmbundle in build 1498 seems  
to have an error, which keeps the traceback from the user script from  
being formatted.

It seems the error offset (e.offset) is a NoneType instead of an int.

This diff fixes the output:

diff --git a/Python.tmbundle/Support/sitecustomize.py b/ 
index ffb3525..a30c6d0 100644
--- a/Python.tmbundle/Support/sitecustomize.py
+++ b/Python.tmbundle/Support/sitecustomize.py
@@ -47,6 +47,7 @@ def tm_excepthook(e_type, e, tb):
          # if this is a SyntaxError, then tb == None
          filename, line_number, offset, text = e.filename, e.lineno,  
e.offset, e.text
          url, display_name = '', 'untitled'
+        offset = offset if offset else 0
          io.write("<pre>%s\n%s</pre>\n" % (escape(e.text).rstrip(),  
" " * (offset-1) + "↑"))
          io.write("<blockquote><table border='0' cellspacing='0'  
          if filename and path.exists(filename) and  
"TM_SCRIPT_IS_UNTITLED" not in environ:

I searched on the gmane list and couldn't find anything, so I hope  
this might prove helpful.

Jaremy Creechley

More information about the textmate mailing list