Skip to content

Rookout/tutorial-python

Repository files navigation

Rookout tutorial for debugging Python applications

CircleCI License Docs GitHub version

A sample app for debugging Python using Rookout.

Helpful links:

Prerequisites

  1. Python 3.5 - 3.9
  2. pip
  3. Optional - Docker - https://www.docker.com/get-docker

Setup

  1. Clone the sample app from this repository:
git clone https://github.com/Rookout/tutorial-python.git
cd tutorial-python
  1. Set your Rookout token as an environment variable (for Windows, use set instead of export)
export ROOKOUT_TOKEN=[Your Rookout Token]
  1. Run the app:
pip install -r requirements.txt
python app.py
  • Optional - Run the app using Docker:
docker run -p 5000:5000 -e ROOKOUT_TOKEN=$ROOKOUT_TOKEN rookout/tutorial-python

Note: On M1-based Macbook laptops, port 5000 is already in use by default, so changing the port binding (5001:5000 for example) may be required.

Usage

  • Log in to the Rookout IDE
  • Set up your debug session by selecting the Python app you started. See Debug session setup for more information
  • Add the source code according to the following instructions. In this case, use the local filesystem option to associate the code in your local 'tutorial-python' folder.
  • Open the file 'app.py'
  • Add a Breakpoint next to line number 96 by clicking next to the line number in the file viewer
  • Go to the app webpage http://localhost:5000/ and add a todo in order to trigger the Breakpoint
  • Check the bottom pane Messages and you'll see the snapshot

Go through the bug list and follow instructions to see some basic use cases.

Common Pitfalls

  • Breakpoint status is pending (hollow with purple outline) -- Connection to the app was not able to be established. Make sure that you inserted the Rookout Token in the right place and that the SDK was properly installed.
  • Breakpoint status is disabled (solid grey) -- The breakpoint was disabled from collecting more data due to the limits being hit.
  • Breakpoint error -- something went wrong. Check the breakpoint status to get more information on the error type, and for more information go to our [breakpoint status guide][https://docs.rookout.com/docs/breakpoints-status/].

Want to learn more ?

License

APACHE 2