Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python debugger tells me value of Numpy array is "*** Newest frame"

Tags:

python

numpy

pdb

What does this mean?

My function gets two numpy arrays from a python/c library. After that function call I turn on the debugger to find a bug, so I add the line to look at the two numpy arrays.

    import pdb; pdb.set_trace() 

But for the values of one of the arrays pdb only returns the message *** Newest frame

PDB output:

(Pdb) type(d) <type 'numpy.ndarray'> (Pdb) type(f) <type 'numpy.ndarray'> (Pdb) f.shape (3, 3, 17856) (Pdb) d[0].shape *** Newest frame (Pdb) d[0] *** Newest frame 
like image 501
Framester Avatar asked Mar 01 '13 15:03

Framester


People also ask

What is __ Array_interface __?

__array_interface__ A dictionary of items (3 required and 5 optional). The optional keys in the dictionary have implied defaults if they are not provided. The keys are: shape (required) Tuple whose elements are the array size in each dimension.

Does NumPy do lazy evaluation?

NumPy doesn't do this, so the challenge is to present the same interface as NumPy without explicitly using lazy evaluation.

What is PDB Set_trace ()?

pdb. set_trace (*, header=None) Enter the debugger at the calling stack frame. This is useful to hard-code a breakpoint at a given point in a program, even if the code is not otherwise being debugged (e.g. when an assertion fails). If given, header is printed to the console just before debugging begins.

Is a NumPy Ndarray is faster than a built in list?

Even for the delete operation, the Numpy array is faster. As the array size increase, Numpy gets around 30 times faster than Python List. Because the Numpy array is densely packed in memory due to its homogeneous type, it also frees the memory faster.


1 Answers

The command d is the command for the debugger used to go down the stack to a 'newer frame'. It seems that the parsing cannot not handle this disambiguity.

Try renaming the variable d.

EDIT: Actually, the comments suggest much better handling than renaming.

like image 91
Jan Avatar answered Sep 22 '22 15:09

Jan