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.
This happens upon occasion for reasons that remain a mystery to us.
Instead of using the Eclipse install process, download the PyDev zip
file from:
https://sourceforge.net/projects/pydev/files/
(use the Download Latest Version link) and copy it to your
Eclipse
dropins
folder. (You need to find where your Eclipse installation is located
in your file system.) Unzip this zip file in that folder. Restart
Eclipse.
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.
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:
Check the Using Eclipse with PyDev tutorial for instructions on how to create this source folder as a default.
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)
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.
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.
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.
If your project referenced another project then you must export the referenced project as well.
The Import Projects dialog shows you this:
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:
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.
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 () 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.
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:
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:
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