Skip to content

How to use Eclipse with PyDev

jaga-mcstas edited this page Sep 7, 2015 · 7 revisions
  • download & install Eclipse:
  1. Select a version here (perhaps the C/C++ version) http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/marsr

  • install PyDev:
  1. Follow the "Installing with the update site" instructions here: http://www.pydev.org/manual_101_install.html

  • set up PyDev:
  1. Start eclipse and select a workspace at start-up: This is the root development folder for this session. The settings are kept in a hidden sub-folder (.metadata) which you can delete if things go wrong.
  2. Click "Workbench".
  3. Click Window -> Preferences.
  4. Go to PyDev -> Interpreters -> Python Interpreter
  5. Click the button on the right called "Quick Auto-Config".
  6. Apply and OK.

This must be done for each new workspace you use.


  • develop a mcstas program with PyDev:
  1. Start eclipse and select a workspace which is one step above the project you want to work on. For example, McCode/tools/Python/ if you want to work on mcrun or mcgui.
  2. Go to File -> New -> Other...
  3. Find and select PyDev -> Pydev Project and click Next
  4. Select the "Project name" equal to the mcstas folder that you want to work in, for example, "mcrun". The project name must match the folder structure exactly!
  5. You will be prompted if you want to open the PyDev perspective - Yes! Now you can open the folder on your left and access the McCode python files.

  • run Python with command-line options:
  1. Open a python file and use Run -> Run As -> "Python Run".
  2. If your script hasn't stopped on it's own: Click the red square icon somewhere in the eclipse UI, to stop it.
  3. Now, go to Run -> Run Configurations.
  4. In the left, go to "Python Run", and click on the only sub-option there. This should be a new "Python Run" configuration, that was just automatically created in step 1. above.
  5. In the middle, you should now see a couple of tabs, including "Arguments"
  6. Configure your command-line arguments for this run configuration in the "Arguments tab" (remember that "python " is handled by eclipse...)
  7. Also rename this Python Run configuration to reflect the changes you have made, since you may have multiple run configs for this project.
Clone this wiki locally