Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • D developer.puri.sm
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

Due to an influx of spam, we have had to impose restrictions on new accounts. Please see this wiki page for instructions on how to get full permissions. Sorry for the inconvenience.

  • David Boddie
  • developer.puri.sm
  • Wiki
  • Debugging Python applications in flatpaks

Debugging Python applications in flatpaks · Changes

Page history
Add information about running pdb. authored Jan 22, 2019 by David Boddie's avatar David Boddie
Hide whitespace changes
Inline Side-by-side
Debugging-Python-applications-in-flatpaks.md
View page @ a22ea28a
......@@ -10,11 +10,37 @@ Assuming that you have a flatpak installed called `com.example.first_application
flatpak run --devel --command=bash com.example.first_application
```
This starts a `bash` shell in the sandbox.
This starts a `bash` shell in the sandbox. You should see something like the following in the terminal:
``` bash
bash-4.4$
```
It is now possible to start debugging the application.
## Starting the Debugger
For low level code debuggers, like GDB, we can usually just run the debugger, set breakpoints and run the application.
For low level code debuggers, like GDB, we can usually just run the debugger, set breakpoints and run the application. For Python applications, it could be useful to use `pdb` instead. For an application script called `your-first-application` in the `/app/bin` directory, you can start debugging by running the `pdb` module as an option to the `python3` interpreter, passing the script as an argument:
``` bash
bash-4.4$ python3 -m pdb /app/bin/your-first-application
> /app/bin/your-first-application(8)<module>()
-> import sys
(Pdb) l
3
4 # Copyright (C) 2018 Purism SPC
5 # SPDX-License-Identifier: GPL-3.0+
6 # Author: David Boddie <david.boddie@puri.sm>
7
8 -> import sys
9 import gi
10 gi.require_version('Gtk', '3.0')
11 from gi.repository import GLib, Gtk
12
13
```
You can then use the usual commands to debug the application.
## References
......
Clone repository
  • Changing the Phosh Wallpaper
  • D Bus examples
  • Debugging Python applications in flatpaks
  • Developer Documentation Overview
  • Devkit I2C Notes
  • Devkit notes
  • Documenting Applications
  • PyGObject Development Notes
  • Home