Page 1 of 1

Setting up EventGhost in Eclipse

Posted: Fri Jan 20, 2012 10:36 am
by phlox
Hi

I was trying to set up a development environment for developing EventGhost plugins using Eclipse / PyDev and I was nearby giving up... but finally I managed to get it working. Since I didn't find much information on how to set up such an environment, I decided to publish here my insights.

Disclaimer: I'm new to Python (however, not new to programming overall), therefore I'm not sure if all information given here is true and relevant! If you know it better, please correct me and provide better instructions!

Note: for simple developments, even simple Plugin development, I guess it's not necessary to install a full fledged development environment. However, if you require source level debugging and code refactoring facilities for example, installing a dev env would be recommended.

Be warned: It's a long and complicate installation procedure! Leave it if you don't have basic development experience. But once you're done, you've all the goodies and benefits of an Eclipse environment.
Didn't I mention it's a long and complicate installation procedure, he :D? However, you're almost done!
  • in Eclipse, right click on 'EventGhost.pyw' > Python run
    ...and yes! if everything went is right, the EventGhost main window will open
  • goto 'Run > Run Configurations > Python > EventGhost.pyw > Arguments > Program arguments' and add '-debug' in order to get debug log output.
  • Add breakpoints whereever you like. When the execution stops at a breakpoint and you started EG in Debug Mode, the Eclipse Debug perspective will open
  • etc.
Open issues:
So far I didn't manage to resolve these issues:
  • 'import eg' causes an 'Unresolved import' error in all plugins (just in the editor, not at runtime). However, code completion (like 'eg.RegisterPl' + Ctrl-Blank) works in most situations as well as open referenced source (F3)
  • 'import stackless' also causes an 'Unresolved import' error
Both issues seem not to affect runtime behavior

Troubleshooting
  • make sure all referenced libraries are found in Eclipse's System PYTHONPATH (Preferences > Pydev > Interpreter Python > Libraries)
  • after installing a new Python library (and the Eclipse setup exists already), it's often the easiest and safest to delete the Python interpreter config (Preferences > Pydev > Interpreter Python > Remove) and add it again. This should set up PYTHONPATH correctly.
  • Sometimes it helps to 'Remove PyDev Project Config' and to add it again by right clicking on the project
I still wonder how experienced Python / EventGhost programmers work. How do you develop and especially debug? - My decision to chose Eclipse was since I'm quite used to it and I was looking for a Python source level debugger.

Any comments / corrections / additions to these instructions are welcome, especially if someone finds solutions for the open issues!