TheLonelyStar | 1 Nov 01:01

Re: interaction between ipython and gvim for debuging


Gökhan SEVER-2 wrote:
> 
> On Fri, Oct 30, 2009 at 3:53 AM, TheLonelyStar
> <nabble2 <at> lonely-star.org>wrote:
> 
>>
>> Hi,
>>
>> I am searching for a solution to debug python programs using gvim and
>> ipython, and found nothing good so far.
>>
>> What would be cool:
>> - open current file and line in gvim from ipython whenever an error
>> occurs
>> - setting breakpoints from gvim
>>
>> So can this be done:
>> - If I have a ipython debug session started, can I somehow invoke a
>> command
>> from the outside (from gvim in this case) which enables and disables
>> breakpoints in a certain file a t a certain position?
>> - Can ipython be configured, that it opens the current file if a error
>> occurs with the correct line?
>>
> 
> Have you seen this thread?
> 
> http://advice.mechanicalkern.com/question/3/how-can-i-integrate-vim-with-ipython
> 
(Continue reading)

TheLonelyStar | 1 Nov 10:45

how does the fix_error_editor hook work?


Hi,

I am trying to integrate ipython am gvim (see my previous post).
I discovered this: http://projects.scipy.org/ipython/ipython/wiki/CookBook,
section "Using gvim in server mode"

I copied the code, and the "fix_error_editor" function works. But when is it
called?
It is not called on syntax error here ...

Any advice?

Thanks!
Nathan
--

-- 
View this message in context: http://old.nabble.com/how-does-the-fix_error_editor-hook-work--tp26148876p26148876.html
Sent from the IPython - User mailing list archive at Nabble.com.
Gökhan Sever | 1 Nov 15:44
Picon
Gravatar

Re: interaction between ipython and gvim for debuging



On Sat, Oct 31, 2009 at 6:01 PM, TheLonelyStar <nabble2 <at> lonely-star.org> wrote:



Gökhan SEVER-2 wrote:
>
> On Fri, Oct 30, 2009 at 3:53 AM, TheLonelyStar
> <nabble2 <at> lonely-star.org>wrote:
>
>>
>> Hi,
>>
>> I am searching for a solution to debug python programs using gvim and
>> ipython, and found nothing good so far.
>>
>> What would be cool:
>> - open current file and line in gvim from ipython whenever an error
>> occurs
>> - setting breakpoints from gvim
>>
>> So can this be done:
>> - If I have a ipython debug session started, can I somehow invoke a
>> command
>> from the outside (from gvim in this case) which enables and disables
>> breakpoints in a certain file a t a certain position?
>> - Can ipython be configured, that it opens the current file if a error
>> occurs with the correct line?
>>
>
> Have you seen this thread?
>
> http://advice.mechanicalkern.com/question/3/how-can-i-integrate-vim-with-ipython
>

Hi,

well that is cool!
This way I can send code from gvim to ipython, very nice.

But how can tell ipython to tell gvim to go to the current line when an
error occurs in pdb?

Can I somehow tell ipython to execute some action on every pdb error and
breakpoint?


Sorry, I am not very experienced in this matter. I tried once to integrate IPython and GVIM, especially before the SciPy09 conference time. These two are my main dev environment, they are just not connected. If I seriously need to use a debugger, I use Eclipse+PyDev. Otherwise I just use traditional way of debugging using simple print statements.

Paul Ivanov from UC Berkeley has more to say on this subject.

Good luck.

 
Thanks!
Nathan
--
View this message in context: http://old.nabble.com/interaction-between-ipython-and-gvim-for-debuging-tp26126749p26146832.html
Sent from the IPython - User mailing list archive at Nabble.com.

_______________________________________________
IPython-user mailing list
IPython-user <at> scipy.org
http://mail.scipy.org/mailman/listinfo/ipython-user



--
Gökhan
_______________________________________________
IPython-user mailing list
IPython-user <at> scipy.org
http://mail.scipy.org/mailman/listinfo/ipython-user
Nathan Huesken | 2 Nov 16:43

Printing breakpoint list

Hi,

Is it somehow possible in ipython/pdb to print a list of the current
breakpoints into a file?

Regards,
Nathan
Reckoner | 2 Nov 22:17
Picon

how to restore %store-ed variable without restarting IPython?

I save a variable by doing

In[10]: %store f

and then I later change it interactively, but I want to return to the
original version. Is there a

In[11]: %reload f

to do that?

Thanks!
Jon Olav Vik | 3 Nov 00:05
Picon

Re: Printing breakpoint list

Nathan Huesken <ipython <at> lonely-star.org> writes:

> Is it somehow possible in ipython/pdb to print a list of the current
> breakpoints into a file?

Use the "break" command (with no arguments) inside the debugger.
http://docs.python.org/library/pdb.html#debugger-commands

Hope this helps,
Jon Olav
Nathan Huesken | 3 Nov 07:29

Re: Printing breakpoint list

On Mon, Nov 02, 2009 at 11:05:27PM +0000, Jon Olav Vik wrote:
> Nathan Huesken <ipython <at> lonely-star.org> writes:
> 
> > Is it somehow possible in ipython/pdb to print a list of the current
> > breakpoints into a file?
> 
> Use the "break" command (with no arguments) inside the debugger.
> http://docs.python.org/library/pdb.html#debugger-commands
> 
> Hope this helps,
> Jon Olav
> 
> 

Hi,

Tanks for the answer, but how do I know store the output of "break" into
a file (or first into a variable)?

I also discovered:
pdb.Pdb.get_all_breaks()

But it just gives me:
*** TypeError: unbound method get_all_breaks() must be called with Pdb
instance as first argument (got nothing instead)

Thanks!
Nathan
Jon Olav Vik | 3 Nov 21:28
Picon

Re: Printing breakpoint list

Nathan Huesken <ipython <at> lonely-star.org> writes:
> > > Is it somehow possible in ipython/pdb to print a list of the current
> > > breakpoints into a file?
> > 
> > Use the "break" command (with no arguments) inside the debugger.
> > http://docs.python.org/library/pdb.html#debugger-commands
[...]
> Tanks for the answer, but how do I know store the output of "break" into
> a file (or first into a variable)?

Ah, I'm sorry...I parsed your question as "print (a list of the current 
(breakpoints into a file))"... 8-)

When would you ever want to print breakpoints to a file? If you're using pdb 
programmatically to set breakpoints, you will already have access to a pdb 
instance (created with p = pdb.Pdb()). Then p.breaks is a dict of the current 
breakpoints. Otherwise, you're using the interactive debugger and can just copy 
output from the command window. Or am I missing something here?

> I also discovered:
> pdb.Pdb.get_all_breaks()

Yes:

In [39]: pdb.Pdb.get_all_breaks??
[...]
Source:
    def get_all_breaks(self):
        return self.breaks

> But it just gives me:
> *** TypeError: unbound method get_all_breaks() must be called with Pdb
> instance as first argument (got nothing instead)

Yes, pdb.Pdb is just a class, you need to instantiate it with Pdb(). This 
works, kind of:
>>> pdb.Pdb().get_all_breaks()
{}

Marginally more usefully:
>>> p = pdb.Pdb()
>>> # add some breakpoints (but how?)
>>> p.get_all_breaks()

I think this feature request, "expose IPython's pdb instance", may be 
sympathetic to your cause.
https://bugs.launchpad.net/ipython/+bug/375764
Maybe the __IP.InteractiveTB.pdb.get_all_breaks() hack could be useful to you.

Best regards,
Jon Olav
Nathan Huesken | 4 Nov 11:36

Re: Printing breakpoint list

> Maybe the __IP.InteractiveTB.pdb.get_all_breaks() hack could be useful to you.

That is exactly what I was looking for! Thanks a lot!
Nathan Huesken | 4 Nov 11:38

autcompletion and trailing space

Hi,

When I do autocompletion (tab) in ipython and it completes a complete
function (or something else) it always adds a trailing space. Most of
the times I have to hit backspace, because I want to type "(" or "."
directly behind the completet name.

Can the trailing space be disabled?

Thanks!
nathan

Gmane