There is a cool little glue package out there called PdbTextMateSupport that allows you to highlight the current line of python code as you debug it in PDB, python’s debugger. It works by sending URLs to textmate – however the python code does not escape spaces in the path, and if you are on OS X there is a decent chance that you have a folder somewhere along the way that might have a space…
Here is the fix:
om os.path import exists
from os import system
import urllib
def mate(self):
frame, lineno = self.stack[self.curindex]
filename = self.canonic(frame.f_code.co_filename)
f2 = urllib.quote(filename)
if exists(filename):
tm_url = 'txmt://open?url=file://%s&line=%d&column=2' % (f2, lineno)
osa_cmd = 'tell application "TextMate" to get url "%s"' % tm_url
system('osascript -e \'%s\'' % osa_cmd)
def preloop(self):
mate(self)
def precmd(self, line):
mate(self)
return line
0 comments ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment