0

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:

Simple Python Script

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:

dist-packages

I tried to add the fully qualified path name to the project's PYTHONPATH using Add Source Folder:

PYTHONPATH Configuration

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:

Add source directory

And here is the result:

Result

1
  • Did you try the External Libraries tab there? Commented Oct 19, 2024 at 3:47

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. That explains the difference between the two kinds of directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.