Howto run iPOPO/Pelix within Eclipse using PyDev

36 views
Skip to first unread message

Freemon Johnson

unread,
Mar 31, 2016, 10:53:10 PM3/31/16
to ipopo-dev
Hello,

Is there a way to run Pelix within Eclipse Mars.2 or remote debugging?

Thanks,
Freemon

Thomas Calmant

unread,
Apr 1, 2016, 5:35:20 AM4/1/16
to ipop...@googlegroups.com
Hi,

The easiest way is to create a "External Tool Configuration" in Eclipse, to run the "pelix.shell" module with Python, and giving it an initialization script as parameter:

Location: ${system_path:python}
Arguments: --init ${project_path:/myproject/run.pelix}

The run.pelix file contains Pelix shell commands, for example:

install pelix.http.basic
# $? contains the result of the last command. "install" returns the bundle ID
start $?

For debugging, you have to activate the "Debug" perspective, and attach a debugger to the shell process (Menu PyDev > Attach to Process).
Note that this feature doesn't work on Windows.

Another way would be to follow the official tutorial for remote debugging: http://www.pydev.org/manual_adv_remote_debugger.html
1. Start a debug server in Eclipse (PyDev > Start Debug Server)
2. In the run configuration, add the path to Pydev sources (environment variables PYTHONPATH, add "...eclipse-mars\plugins\org.python.pydev_4.5.5.201603221110\pysrc")
3. In the modules to debug, import pydevd and call pydevd.settrace()

Cheers,
Thomas

--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes "ipopo-dev".
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse ipopo-dev+...@googlegroups.com.
Pour obtenir davantage d'options, consultez la page https://groups.google.com/d/optout.

Freemon Johnson

unread,
Apr 1, 2016, 8:42:57 AM4/1/16
to ipopo-dev
Thank you again Thomas. If I have any questions I will post them.

Cheers,
Freemon

Thomas Calmant

unread,
Apr 2, 2016, 9:57:00 AM4/2/16
to ipopo-dev
Hi,

Here is a sample Eclipse/Pydev project that can be imported as is.
It shows how to setup the path to pydevd, with a sample bundle:

- The launch configuration starts "python" as an external tool, running a pelix shell with a setup script and an ECLIPSE_HOME environment variable.
- The setup.pelix script installs and starts the pydevd_setup.py bundle, which looks for the PyDev plugin installation path and adds it to sys.path
- A test_debug.py bundle is also installed, but not started.

Start the PyDev remote debug server, then start the test_debug bundle from the running Pelix shell: it will call pydevd.settrace() in its activator.

Cheers,
Thomas
sample_remote.zip

Freemon Johnson

unread,
Apr 3, 2016, 8:14:34 AM4/3/16
to ipopo-dev
Thanks Thomas this worked!!!

Cheers,
Freemon

Reply all
Reply to author
Forward
0 new messages