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...

Project Out of Sync
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.

My project doesn't have a proper src folder, or so the assignment/lab validator tells me.

When creating an Eclipse PyDev project, Eclipse should automatically creates a separate source code folder named src, which is where all your PyDev source code files (.py) must be located. If such a folder does not exist, create one and move your PyDev source code files into it. This folder is not a standard folder, it is a source code folder, and must be created as shown:

Source Folder Creation
source_folder (16K)

Check the Using Eclipse with PyDev tutorial for instructions on how to create this source folder as a default.

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:

Perspectives
Perspective

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.

I'm attempting to create a new project or import a project from a zip file, but Eclipse tells me the project already exists.

The Import Projects dialog shows you this:

Project Import Failure
importFails

This means that although the project is not displayed in the Package Explorer, there is still a folder of that name in the workspace. (See: Using Eclipse/PyDev tutorial for instructions on properly deleting a project.). The project must be deleted from the workspace using your operating system tools, such as File Explorer or Finder. To find your workspace folder, from the Eclipse main menu choose File / Switch Workspace / Other to bring up the Select a directory dialog:

Find Your Workspace
selectDirectory

The location of your workspace folder on your computer is shown in this dialog. After deleting the project inside the workspace folder you should be able to import the project zip file.

I have programs that won't stop running and my computer is running slowly

Watch out in particular for infinite loops while working with while loops. Having too many Python programs running inside Eclipse can literally slow down your machine, and if enough programs are running cause it to crash, and you don't want this to happen during an exam! Red squares (Red Box) show up on the Console when a program is running. To kill an infinite loop, click on the red square(s): Terminate All. All Python programs currently running in Eclipse are stopped.

Terminate a Program
Terminate a Program

I see Java Main Sources instead of my projects in the PyDev Package Explorer

The PyDev Package Explorer is not in the correct mode, it needs to be set to Projects rather than Working Sets. Left click on the three vertical dots beside the PyDev Package Explorer and choose Top Level Elements / Projects:

Top Level Elements
Top Level Elements

I don't get a zip file in my Downloads folder when I try and download a zipped project for import

In your browser, make sure you have right-clicked on the zip link and chose Save As, then selected the Downloads folder.

If you have problems downloading and importing zipped projects on a Mac, this may be the issue:
Safari automatically unzips the file that you download, which is pretty much exactly what you don't want to have happen. You can't import a zip file if you don't have a zip file.
Two possible solutions:

My Mac is giving me the error:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

This generally means that you have recently updated to a new Mac OS version, and you must install XCode (a Mac IDE) from the Mac command line. Open a Terminal session (Applications / Utilities / Terminal) and run this command:

xcode-select --install

Thanks to: https://gist.github.com/gaquino/87bdf0e6e852e445c0489379d3e9732a