[IPython-User] IPython.Debugger with v0.10 and 0.11

Johannes Korn korn@freisingnet...
Fri Apr 13 04:08:57 CDT 2012


Hi

so far I used the following syntax to set breakpoints in my python 
scripts for debugging in ipython v0.10.

However, with ipython v0.11 this does not work anymore (see below). I´m 
not sure where I got this snippet from so maybe this was never intented 
to be used for setting breakpoints?! Is there a method that works in 
ipython v0.10 and v0.11?

Regards

Johannes

--------------------------
from IPython.Debugger import Tracer
debug_here = Tracer()

print 'hello'
debug_here() # Break here
print 'hello'

--------------------------

In [1]: %run test.py
hello
 > /home/users/rein_be/cloudprops/spain_morocco_eval1/test.py(6)<module>()
       4 print 'hello'
       5 debug_here()
----> 6 print 'hello'

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (99, 0))

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/home/users/rein_be/cloudprops/spain_morocco_eval1/test.py in <module>()
       4 print 'hello'
       5 debug_here()
----> 6 print 'hello'

/home/users/rein_be/cloudprops/spain_morocco_eval1/test.py in <module>()
       4 print 'hello'
       5 debug_here()
----> 6 print 'hello'

/usr/lib64/python2.7/bdb.pyc in trace_dispatch(self, frame, event, arg)
      46             return # None
      47         if event == 'line':
---> 48             return self.dispatch_line(frame)
      49         if event == 'call':
      50             return self.dispatch_call(frame, arg)

/usr/lib64/python2.7/bdb.pyc in dispatch_line(self, frame)
      64     def dispatch_line(self, frame):
      65         if self.stop_here(frame) or self.break_here(frame):
---> 66             self.user_line(frame)
      67             if self.quitting: raise BdbQuit
      68         return self.trace_dispatch

/usr/lib64/python2.7/pdb.pyc in user_line(self, frame)
     156             self._wait_for_mainpyfile = 0
     157         if self.bp_commands(frame):
--> 158             self.interaction(frame, None)
     159
     160     def bp_commands(self,frame):

/usr/local/lib/python2.7/site-packages/IPython/Debugger.pyc in 
interaction(self, frame, traceback)
     279     def interaction(self, frame, traceback):
     280         __IPYTHON__.set_completer_frame(frame)
--> 281         OldPdb.interaction(self, frame, traceback)
     282
     283     def new_do_up(self, arg):

/usr/lib64/python2.7/pdb.pyc in interaction(self, frame, traceback)
     203     def interaction(self, frame, traceback):
     204         self.setup(frame, traceback)
--> 205         self.print_stack_entry(self.stack[self.curindex])
     206         self.cmdloop()
     207         self.forget()

/usr/local/lib/python2.7/site-packages/IPython/Debugger.pyc in 
print_stack_entry(self, frame_lineno, prompt_prefix, context)
     330         frame, lineno = frame_lineno
     331         filename = frame.f_code.co_filename
--> 332         __IPYTHON__.hooks.synchronize_with_editor(filename, 
lineno, 0)
     333         # vds: <<

     334

AttributeError: 'function' object has no attribute 'synchronize_with_editor'



More information about the IPython-User mailing list