Live Debugging

Capturing Exception Call Stacks in Python Applications with Sidekick

Capturing and debugging error stacks for significantly enhancing developer productivity.
Mehmet Yildiz
3 mins read

What is the Sidekick?

Sidekick is an open-source live application debugger that lets you troubleshoot your applications while they keep on running. It is like Chrome DevTools for your and built for everyone who needs extra information from their applications.

Sidekick Actions ( logpoint and tracepoint ) are giving developers dynamic logging and live debugging abilities. They are most powerful when you know exactly where you should put them.

Why do we use the Sidekick while exception call stacks capture?

When your product runs in development or production environments, it can probably encounter and throw some errors. In such a cases, it can be difficult to debug these errors. Despite that, Sidekick allows you to easily capture and debug them.

In addition, through its extensions developed for IDEs (e.g. Visual Studio Code Extension, PyCharm Plugin). It allows you to easily debug your application without changing your working environment.

Sidekick currently collects error call stacks in both Python and Node.js applications. In this article I’ll be explaining Sidekicks Error Stack Collection for Python applications.

Let’s try it in action!

Install Python and Pip

Firstly, we need to make sure that the following tools are installed and versions are correct in the system we will use:

python v3.6 — v3.8 (
pip v21+ (

Clone Project

We have prepared a Flask project that we will use for the tutorial. First, lets clone it from GitHub.

git clone

Install the Requirements

cd ./flaskr-tdd/
pip install -r requirements.txt

Set Environment Variables for the Sidekick

Next, make sure the following environment variables are set correctly for the project and the Sidekick tool to work correctly. You can either EXPORT those variables or create a .env file. Check docs for more info.

SIDEKICK_APIKEY= #get one from
SIDEKICK_APPLICATION_NAME= #e.g. my-application 
SIDEKICK_APPLICATION_STAGE= # e.g. dev, prod ... etc.


Everything is ready! Let’s start the application

Lets run our application with the following command.

python -m flask run

Error Call Stack Capturing

In this section, we will talk about capturing error call stacks via the Sidekick. When we complete all the steps above, your Flask application will be up and running.

First, we have added some error-throwing code snippets inside the project. In the project, these errors are thrown in case of an invalid username and password while the user logs into the system.

As you see, we will throw an error while username and password are not satisfied the requirements. To go to login page, please enter the url on web browser:


Now you can see the login screen. Here, we will try an invalid username and then an invalid password.

Invalid Username Example
Invalid Password Example

As seen in the examples above, submitting an incorrect username or password should produce two different error messages. We will now capture these error messages with the Sidekick.

When we submit the inputs above, the application will throw an error for each case. Now, let’s go to the Sidekick screen and see if it catches these errors.

Sidekick Web UI — Error Snapshot for Invalid Username
Sidekick Web UI — Error Snapshot for Invalid Password

BINGO! We got it! The error results were informed by Sidekick, as you can see. In addition, Sidekick can show the types of errors. As seen in this example, there are two error types that are “Exception” and “ValueError”. As seen here, the values of the variables in the method appear as you click on the errors.


To summarize my post, I briefly talked about catching error call stacks in Python and how to use Sidekick to do this action easily and quickly. Apart from the Flask framework used here, it also works in Sidekick, FastAPI, Django etc. frameworks. In addition, you can easily use Sidekick’s features and advantages through your IDE via PyCharm and Visual Studio Code extensions.


With Sidekick ErroR Stack Collection, developers can now activate automatic error stack collection and start collecting exception call stacks from their running applications without stopping them. A great addition to Sidekick Actions that will help you boost your developer productivity even more.

Sidekick is open-source and brings almost no overhead to your applications. Visit to meet your new live application debugger.

Please let us know your invaluable ideas because they will guide us on our path to discovering the future of application observability. You can get in touch with us through Twitter, and join our Discord community.

Fresh insights from Sidekick experts every week.

Get the best insights, delivered straight to your inbox.