Skip to content

Tag: debugging

scipy.signal.find_peaks return empty properties

I tried to obtain properties from scipy.signal.find_peaks, but it returns an empty dictionary {}. Can anyone help to fix it? Answer The problem is that you are passing None to prominence. None is already the default value, and is used to signal that no value for the argument was given. Pass a numeric value as below: Output

Strange bugs in Python program: `str() cannot be interpreted as integer

I’m converting many of my R programs to Python (a language I don’t use on a day-to-day basis). Here my program, which simulates a simple card game: Appearently the bug is in the fill_envelopes line. Here’s the error returned by the interpreter: It seems that the interpreter is trying to treat a string object as an integer. This was found

Print current call stack from a method in code

In Python, how can I print the current call stack from within a method (for debugging purposes). Answer Here’s an example of getting the stack via the traceback module, and printing it: If you really only want to print the stack to stderr, you can use: Or to print to stdout (useful if want to keep redirected output together), use: