Run Python Debugger (pdb) in Sublime Text 3 Run Python Debugger (pdb) in Sublime Text 3 python python

Run Python Debugger (pdb) in Sublime Text 3


python breakpoint plugin and check this link python breakpoint debugger

Use ctrl+shift+b to toggle breakpoint in a line

But its not preferable solution for debugging a software using a text editor.There are best IDE which makes your development lot easier

  • visual studio community edition

  • Pycharm

  • Eclipse

  • Komodo


If you don't want to deal with additional packages, you can create a snippet to set the breakpoint for you.

<snippet>    <content><![CDATA[import pdb;pdb.set_trace()]]></content>    <tabTrigger>pdb</tabTrigger>    <scope>source.python</scope>    <description>Insert a breakpoint</description></snippet>

The above snippet will trigger whenever you type pdb in your code.autocomplete window when the snippet is triggered

Instructions On a Mac

  • Navigate to Tools -> Developer -> New Snippet
  • Replace the template with the snippet above
  • Save the snippet to ~/Library/Application Support/Sublime Text 3/Packages/User
  • Ensure the name ends with sublime-snippet (ex. breakpoint.sublime-snippet)

It should start working immediately after saving.

---------- UPDATE 29 NOV 2019 ----------

As mentioned by @FamousSnake in the comments below, you can modify the snippet to use the built-in breakpoint() function if you're using Python 3.7 or higher. This is especially convenient if you use linters or utilities like black to format your code. It should get them to stop complaining or splitting the code above into multiple lines. You can use the revised snippet below:

<snippet>    <content><![CDATA[breakpoint()]]></content>    <tabTrigger>pdb</tabTrigger>    <scope>source.python</scope>    <description>Insert a breakpoint</description></snippet>


You could try to use an IDE specific for Python which makes debugging and setting up python projects really easy. I would recommend you try the free community version of Pycharm.

https://www.jetbrains.com/pycharm/download/