Physics & Computer Science

PyDev Problems

There are a number of typical problems that can arise when using Eclipse / PyDev. Here are some of those problems and their solutions. Please feel free to suggest others to the Lab Instructor as they arise.

I get an error when exporting my project, something about Resource is out of sync with the file system...

resource_sync (11K)

Eclipse thinks that a project file has been changed by a non-Eclipse program. (This can happen if you edit anything in the project folder from outside Eclipse.)

Your .zip file has actually been exported. To get rid of the error, however, go back to the project, right click on the project name and choose Refresh. (You may also just press the F5 function key.) This 'resyncs' the project, and you may export it without annoying error messages. You may have to overwrite the original .zip file.

Do Not export a project .zip file to your workspace. This can confuse Eclipse - and you.

The validator tells me I have a problem: Wrong grammar version. Use Grammar Version 3.0 or better only. What does this mean, and how can I fix it?

This means that when you created your project, you did not properly select Grammer Version 3.0 as the Using Eclipse/PyDev tutorial requires:

grammar_error (15K)

You can fix this after the fact. Right click on the project name and choose Properties. From the properties list, choose PyDev - Interpreter/Grammar. In the PyDev - Interpreter/Grammar dialog, select 3.0 from the Grammar Version drop-down list:

grammar_fix (33K)

Where are my projects? The Package Explorer pane is empty, or has projects I don't recognize.

If you cannot see your projects in the Package Explorer pane, you are in the wrong workspace. The very first thing you should do upon starting Eclipse is to make sure you are in the proper workspace. (See Setting a Workspace)

My Eclipse main window looks wrong. When I right click on files, I don't see my PyDev options.

Eclipse supports multiple perspectives, or modes, depending on what language you are programming in (Python, Java, C, etc.) If Eclipse is not behaving properly, you are in the wrong perspective. Your current perspective is shown on the upper-right corner of the Toolbar pane:


The PyDev perspective should be highlighted. If not, simply click on it. If you do not see the PyDev perspective at all, click on the Other perspective (the first icon in the perspective list) and choose PyDev from the Open Perspective dialog box.

You can also do this from the menu bar, choosing Window / Open Perspective / [Other...], and choose PyDev.

My program is running in the Console pane, but I cannot enter any data into it.

If the Console does not seem to be recognizing your input, or worse, your input is showing up in the Editor pane, then the Console pane does not have focus. When you start executing a program the Console pane does not automatically get focus - i.e. anything you type still goes into the Editor. Simply click anywhere on the Console pane to give it focus. (The Console tab turns blue when it has focus.) Don't worry about where you click on the pane, your input will go to the right place automatically.

I entered a program and it looks correct, but when I try to run it, I don't even get the Python options, just something about a Local C/C++ Application.

Python can only run programs that they recognize as Python programs. In order to be recognized as a Python program a file must have .py at the end. Your file lacks this extension. (You should also notice that the program lacks the colour-coding mentioned in the The Editor Pane section.) In the Navigator pane, right click on the file and choose Rename to fix the problem.

I exported my project correctly, but it doesn't work when I import it into another workspace.

If your project referenced another project then you must export the referenced project as well.