View Single Post
Old 09-29-2020, 03:37 AM   #1
paulriddle
Junior Member
paulriddle began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Sep 2020
Device: none
Help me start a debugging session with pudb

This is not a question about pudb specifically, I am more interested in figuring out why Python doesn't see the module I installed.

Hello. My goal is to debug calibre with external debugger https://documen.tician.de/pudb/starting.html

I insert breakpoint here:

https://github.com/kovidgoyal/calibr...ug/main.py#L45

Breakpoint looks like this:
Code:
import pudb; pu.db
I run calibre as

Code:
calibre-debug main.py -- /path/to/ebook.mobi
It says

Code:
Traceback (most recent call last):
  File "runpy.py", line 194, in _run_module_as_main
  File "runpy.py", line 87, in _run_code
  File "site.py", line 48, in <module>
  File "site.py", line 44, in main
  File "/home/paulriddle/code/calibre/src/calibre/debug.py", line 336, in main
    run_script(args[1], args[2:])
  File "/home/paulriddle/code/calibre/src/calibre/debug.py", line 243, in run_script
    exec_path(ef, g)
  File "/home/paulriddle/code/calibre/src/polyglot/builtins.py", line 110, in exec_path
    exec(code, ctx)
  File "/home/paulriddle/code/calibre/src/calibre/ebooks/mobi/debug/main.py", line 51, in <module>
    main()
  File "/home/paulriddle/code/calibre/src/calibre/ebooks/mobi/debug/main.py", line 46, in main
    import pudb; pu.db
ModuleNotFoundError: No module named 'pudb'
I try installing pudb using 3 methods:

Code:
1. pip install --user pudb
2. pip install pudb
3. pipx install pudb
None of them helped calibre detect the module. I'm really new to Python, so I'm not sure what I am doing wrong. I installed calibre using the binary installer, and *not* my package manager (pacman on ArchLinux). Although I tried installing with my package manager as well, it did not help.

I set
Code:
CALIBRE_DEVELOP_FROM=/home/paulriddle/code/calibre/src
and made sure my shell is reloaded. This way the suggested methods of debugging work, for example I can insert print statement in the checked out source and calibre will execute them. The question is how do I integrate an external debugger like pudb with calibre? Because I'm new to Python I'd like to have the extra interactivity that pudb provides, it will help me understand the code in the beginning.

Python 3.8.5
paulriddle is offline   Reply With Quote