Added later: I stupidly capitalized OS rather than using os, so the import and print now works properly. However, the question remains: how can I add a source directory that is outside the project directory without PyDev prepending the name of the project?
I installed Eclipse/PyDev on Linux Mint 19.2 and wanted to test a simple script to make sure everything was correct. This script is shown here:
As is obvious from the image, PyDev couldn't find the module OS. The interpreter for the project is python3.6 and the OS module is located in /usr/lib/python3.6/dist-packages:
I tried to add the fully qualified path name to the project's PYTHONPATH using Add Source Folder:
However, PyDev prefixed the path name with PrintOSName, the name of the project, so instead of /usr/lib/python3.6/dist-packages, it inserted PrintOSName/usr/lib/python3.6/dist-packages, which is obviously wrong. How do I prevent PyDev from prepending the project name to the source directory containing the standard Python modules?
Added later: here is the Add source folder window using a source directory outside the project:
And here is the result:
In the project configuration:
External libraries
is for things which are anywhere in your computer (so, you can use full paths here -- possibly making use of variables).
Source folders
are expected to be used for things in your workspace (so, paths are expected to be resolved as relative to your workspace).