Konubinix' opinionated web of thoughts

Debug Offlineimap With Dap-Mode

Fleeting

debug offlineimap with dap-mode, using debugpy

sudo apt install python3-debugpy

Beware that the program is in fact not /usr/bin/offlineimap, because it is a symbolic link.

ls -la /usr/bin/offlineimap
lrwxrwxrwx 1 root root 25 Jan 10  2023 /usr/bin/offlineimap -> ../share/offlineimap3/run

Running the debugger with /usr/bin/offlineimap will result in python not finding the offlineimap library that is located in /usr/share/offlineimap3/offlineimap

(dap-register-debug-template
 "debug offlineimap"
 (list :type "python"
       :args (format "-c %s -a %s" conf-file account)
       :cwd nil
       :module nil
       :program (file-truename "/usr/bin/offlineimap")
       :request "launch"
       :name "debug offlineimap"))