HOW-TO:Debug python scripts with WinPDB

From XBMC
Jump to: navigation, search

You can easily debug python scripts running inside XBMC in a few simple steps using WinPDB!

Contents

1 Requirements

2 Create a symlink for the debugger

How to make a symlink in Linux

$ cd /home/<user>/.xbmc/scripts/Foo
$ ln -s `find /usr/lib/pymodules -name rpdb2.py`

How to make a symlink in Windows

For Windows 7

mklink "C:\Program Files (x86)\XBMC\addons\plugin.video.icefilms\rpdb2.py" "C:\Python27\Scripts\rpdb2.py"

For Windows XP, Vista

fsutil hardlink "C:\Program Files (x86)\XBMC\addons\plugin.video.icefilms\rpdb2.py" "C:\Python27\Scripts\rpdb2.py"

The first path makes the link in your addon folder, the second path tells the link to point to where the original rpdb2.py file can be found.

3 Modify your script to enable debugger

import rpdb2 
rpdb2.start_embedded_debugger('pw')

4 How to start WinPDB

C:\Python27\Scripts\winpdb.py

5 Start debugging session

6 Setting breakpoints

TBD

7 Screenshot

Winpdb-session.png

8 See also

Development:

Personal tools
Namespaces
Variants
Actions
Navigation
Wiki help
Google Search
Toolbox