10

I have just switched to Sublime Text 2 for my Python development. I usually do web programming with the Flask micro framework.

What are my debugging options with this combination, and how do I set it up? I'm working on Windows 7.

1 Answer 1

10

Use pdb:

import pdb; pdb.set_trace()

(or the even better pdb++)

Also, Flask already include Werkzeug which contains an interactive JavaScript based in-browser debugger, I highly recommend you utilize it.

(if your Flask uses uWSGI you can check out this guide to make Werkzeug debugger work: debugging flask application under uWSGI)

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

5 Comments

Thx for your answer, but will it be possible to set breakpoints in code and step through it if I use pdb?
@happygoat yes, you can simply put import pdb; pdb.set_trace() to the line you want to break at.
Real men and women use ipdb pypi.python.org/pypi/ipdb (and spend a less time to do it, because arrow keys and history works)
@MikkoOhtamaa thanks for the suggestions, I haven't used it before but will give it a try :)
Also worth noting; Once you've hit the break point and munged/inspected whatever you want to, you can continue the execution with continue - maybe continue() if you not using ipdb.

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.