[IPython-user] Debug a script with a function

Jonas813 Jonas.Baggett@edu.hefr...
Tue Sep 16 04:44:50 CDT 2008


Hello, 
I am using ipython 0.8.4-1 with debian testing.
I didn't find how to debug a script (test.py) with a function under ipython.
I can debug a script with "run -d", but I can't exec a function from a
script with "pdb.run(...)"

Here is my script test.py

def fct(a):
   print a

Under the python interpreter, it works fine :
>>> import test as t
>>> import pdb as p
>>> p.run('t.fct(3)')
> <string>(1)<module>()
(Pdb) s
--Call--
> /home/jonas/test.py(1)fct()
-> def fct(a):
(Pdb) l
1 -> def fct(a):
2 print a [EOF]
(Pdb)


But with the ipython interpreter, it doesn't work.

In [1]: import test as t

In [2]: import pdb as p

In [3]: p.run('t.fct(3)')
> <string>(1)<module>()
(Pdb) l
[EOF]
(Pdb) s
NameError: "name 't' is not defined"
> <string>(1)<module>()
(Pdb) q


I also noticed that there is problem with the colors of the debugger  :
sometimes the color choosen is white !!!

ipdb> l
      1 # import psyco
      2 # psyco.full()
      3
1---> 4 from numpy import *
      5
      6 def simplex(B):
      7
      8         # A=hstack([vstack([[3,2],[15,25],[0,1],[-7,-10]]), eye(4),
vstack([1200,7500,200,0])])
      9         A=B.copy()
     10
     11         # Dimensions de la matrice

In this example the words numpy, simplex, B, A, copy where in white, so they
are not visible unless (als I did here) I copy and paste the output.
Of course I can change the background color of my terminal, and the problem
is fixed.


Thanks for any answers
Jonas
-- 
View this message in context: http://www.nabble.com/Debug-a-script-with-a-function-tp19508588p19508588.html
Sent from the IPython - User mailing list archive at Nabble.com.



More information about the IPython-user mailing list