Archive:Debug Python Scripts with Eclipse: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
>Temhil
(1st draft)
 
>Temhil
No edit summary
Line 1: Line 1:
Here is a method you can use in order to use the Eclipse remote debugger with you Python scripts/plugin.
Here is a method you can use in order to use the Eclipse (multi-platforms) remote debugger with you Python scripts/plugin.


Note: you can more information if you prefer to use WinPDB instead: [[HOW-TO_debug_Python_Scripts|Debugging Python Scripts on Linux with WinPDB]]
Note: you can more information if you prefer to use WinPDB instead: [[HOW-TO_debug_Python_Scripts|Debugging Python Scripts on Linux with WinPDB]]
Line 24: Line 24:


===Configure Pydev and Eclipse===
===Configure Pydev and Eclipse===
====Add Pyhton Interpreter Path====
* Go in Window -> Preferences
* Go in Window -> Preferences
* Pydev then Interpreter Python
* Pydev then Interpreter Python
Line 29: Line 30:
[[File:EclipsePydevPref.png]]
[[File:EclipsePydevPref.png]]
This will help in order to have Python code completion (except for XBMC modules)
This will help in order to have Python code completion (except for XBMC modules)
====Add Pydev view to Eclipse====
* On the top right corner clic on the View button on select Others
[[File:EclipsePydevViewMenu.png]]
* Select Pydev then OK, a PyDev View Button should be now available on the top right corner
[[File:EclipsePydevViewMenu2.png]]
Use this view for your developments in Python for XBMC
====Add Pydev Start/Stop debug server buttons====
* Right clic on the toolbar
* Select customize perspective..., a window customize perspective will open
* Select Command Groups Availability tab
* Check Pydev Debug box and OK
* You should see 2 new buttons in your toolbar
[[File:EclipsePydevDebugSrvButtons.png]]
====Setting the remote debugger port (optional)====
If you do not want to use the default port (usually 5678) you can set it up:
* Go in Window -> Preferences
* Pydev then Debug: you can define here the port and the timeout you want
==Create a Python script/plugin for XBMC in Eclipse==
Most of the time

Revision as of 23:43, 3 April 2010

Here is a method you can use in order to use the Eclipse (multi-platforms) remote debugger with you Python scripts/plugin.

Note: you can more information if you prefer to use WinPDB instead: Debugging Python Scripts on Linux with WinPDB

Prerequisite

  • Any platform able to run Eclipse IDE (Windows 32bit, Mac Carbon 32bit-64bit, Mac Cocoa 32bit-64bit, Linux 32bit-64bit): it is the platform from where you will run the debugger IDE
  • Pyhton interpreter 2.4 (same version as XBMC) install on the machine running Eclipse
  • Any platform running XBMC (Xbox, Linux, MACOSX, Windows): it is the platform running Python scripts/plugin connecting with the remote debugger.

XBMC installed on Ubuntu (should work just fine on Windows and Mac too)

  • Pydev plugin for Eclipse IDE: Pydev is a Python IDE for Eclipse, which may be used in Python, Jython and IronPython development.

Prepare and Setup Eclipse

Install Eclipse

Note: in our example Eclipse Galileo (3.5.1) is used

Install Pydev in Eclipse

  • In Eclipse go in: Help -> Install New Software...
  • Clic on the Add button and add Pydev website as a source: http://pydev.org/updates
  • You will see the window below:

EclipsePydevUpdate.png

  • Check PyDev box and follow the steps in order to install PyDev

Note: in our example PyDev 1.5.5

Configure Pydev and Eclipse

Add Pyhton Interpreter Path

  • Go in Window -> Preferences
  • Pydev then Interpreter Python
  • Clic on Add and Browse for your Python Interpreter 2.4, you should see something like that:

EclipsePydevPref.png This will help in order to have Python code completion (except for XBMC modules)

Add Pydev view to Eclipse

  • On the top right corner clic on the View button on select Others

EclipsePydevViewMenu.png

  • Select Pydev then OK, a PyDev View Button should be now available on the top right corner

EclipsePydevViewMenu2.png Use this view for your developments in Python for XBMC

Add Pydev Start/Stop debug server buttons

  • Right clic on the toolbar
  • Select customize perspective..., a window customize perspective will open
  • Select Command Groups Availability tab
  • Check Pydev Debug box and OK
  • You should see 2 new buttons in your toolbar

EclipsePydevDebugSrvButtons.png

Setting the remote debugger port (optional)

If you do not want to use the default port (usually 5678) you can set it up:

  • Go in Window -> Preferences
  • Pydev then Debug: you can define here the port and the timeout you want


Create a Python script/plugin for XBMC in Eclipse

Most of the time