Re: Fast jump to error lines?
Matthias Bussonnier <[email protected]> Wed, 24 Jun 2015 16:22:44 +0200
| Newsgroups | gmane.comp.python.ipython.user |
|---|---|
| Message-ID | <CANJQusU8Rr-A8sn_UT=YEfakSENYDAGV=7FX0rV11+D-_sraYQ@mail.gmail.com> |
Hi Charles, Thanks for your question. May I ask where you found the link to this Mailing List ? We have been trying to deprecate IPython-User in favor of [email protected] which is much more active. If you want more chance to get a response I would suggest asking questions there. I can still give you hint. You probably do not want to parse the string, but to access the last traceback raised. see https://docs.python.org/3.5/library/sys.html#sys.last_traceback and also the %debug magic of IPython. Your request make sens imho, it will have a few edge cases (not all file may exists), so if I was you I would open a feature request on IPython, or even send a Draft PR. It's easier to review code and link to existing code on GitHub. How does that sound ? -- Matthias On Wed, Jun 24, 2015 at 2:42 PM, Charles Fox <[email protected]> wrote: > Hi all, > > I just joined this list to ask a question that's been bugging me for ages, I > wonder if anyone has any suggestions: > > I'd like to optimize my IPython workflow some more. I work in IPython and > vim, using "ed" to enter Vim for ipython. When my program dies I see the > backtrace, make a mental note of the file and line number of the error, type > "ed <filename>" then use ":" in vim to jump to the error line. I'd like to > reduce the cognitive load here by defining an ipython command that does this > automatically. So when I see the backtrace, I type a command and it opens > vim with the right file and error line. > > I think like most iPython users, doing this debuging dance takes up a > significant portion of my day, so it seems worth automating. But it seems > strange that no-one has already built this yet -- is there some reason for > that? Maybe some feature already exists to do this that I don't yet know > about? Or is there a technical problem to build it? > > Is anyone else wanting a tool like this? > > I looked at IPython internals just a little bit to tweak the debugger > displays before, but I'm not sure where this feature would live, or how to > access the backtrace text from the ipython console programatically. I'd > want to parse out the filename and line number than open vim with > "+<linenumber>", from within IPython code. Any suggestions could be really > useful? Could it be done as a magic or does it need changes to IPython > code itself? > > > > _______________________________________________ > IPython-User mailing list > [email protected] > http://mail.scipy.org/mailman/listinfo/ipython-user >