0

In order to get the stacktrace of a python program, I am trying to follow this example. In the article, the author invokes the gdb as follows. However, the python version of my environment is python 3.4.4. When I type

python3.4-dbg  testmyplotlib2.py &

The error message is python3.4-dbg: command not found. What's the right way to get stacktrace by using gdb.

enter image description here

1
  • Not trying to state the obvious here but I think you might not have the debug built installed. (Command not found is the shell warning that something with that name doesn't exist). Here's an article about the setup on Ubuntu wiki.ubuntu.com/PyDbgBuilds Commented Aug 22, 2016 at 20:30

2 Answers 2

1

What OS are you on? It looks like you need to install python3.4-dbg. If you are on Linux, you will need to enter:

sudo apt-get install python3.4-dbg

Sign up to request clarification or add additional context in comments.

Comments

0

GDB is excellent program for debugging, but if printing traceback is the only reason you are installing GDB, do not do it, that is waay overkill. You can just import traceback and

  1. use traceback.format_stack() to get an array of calls that lead to the location in program
  2. use traceback.print_stack() to print it to command line
  3. use print traceback.format_exc() to print what lead to the current exceptions (works in except clasuse)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.