Book Image

Mastering PyCharm

By : Nafiul Islam
Book Image

Mastering PyCharm

By: Nafiul Islam

Overview of this book

Table of Contents (18 chapters)
Mastering PyCharm
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Running, debugging, and setting breakpoints


You can run a .py file in two modes: running and debugging. If you run a program, then even if you set breakpoints (points at which PyCharm will stop program execution), nothing will happen. It's only when you run it in debug mode that breakpoints become effective. The way I like to run or debug my programs is through the Resume Program action:

You can then choose any of the different ways to run/debug your program. By default, if you press Enter, you will go into debug mode, if you press Shift + Enter, the program will just run. You can also choose coverage by pressing the left arrow:

As soon as you start debugging, a window appears underneath and you have so many options that it's hard to make sense of it all. Let's focus on managing breakpoints for now. To the bottom-left of the window, you can see a bunch of buttons:

This is the View Breakpoints button. This allows you to see different types of breakpoints that are available to you:

The breakpoint...