11

When deleting a source folder in a PyDev project in the Project Explorer, the project PYTHONPATH is not updated and there is a red x marking in the outline with an error message saying "Source folder: [source folder name] not found".

Is this really the intended behavior? I would expect the PYTHONPATH to be updated if source folders are removed.

I'm using PyDev version 2.7.3 and Eclipse 3.7.2.

Steps to repeat the problem:

  1. In Project Explorer, create a new PyDev project with File -> New -> PyDev Project
  2. Create a new PyDev source folder by right-clicking the new project and selecting New -> Source Folder (under the PyDev menu)
  3. Remove the source folder (which was just added) by right-clicking the source folder and select Delete.
  4. Add a new source folder (needed to trigger the error).
  5. There is a red x error mark and a message saying "Source folder: [source folder name] not found".
  6. Go to PyDev Properties. The deleted folder is still listed in the Source Folders tab under PyDev-PYTHONPATH.

Note: When repeating the steps above in the Package Explorer instead of the Project Explorer, the red x's don't show up - so you can't see there is a problem. However, if you look in PyDev properties the behavior is the same - PYTHONPATH is not updated.

4
  • Hi @billie did you find an answer to this issue? PyDev is doing this to me too... Commented Aug 10, 2013 at 17:39
  • Hi No, unfortunately I didn't. Still hoping for a reply from PyDev developers :) Commented Aug 12, 2013 at 11:12
  • Did you create a ticket at sw-brainwy.rhcloud.com/tracker/PyDev? What's the ticket#? I'll get on there and comment with my steps to reproduce :) Commented Aug 12, 2013 at 18:18
  • Also would like to see this issue resolved Commented Aug 21, 2013 at 8:34

4 Answers 4

14

Right click on your project folder->Properties->PyDev - PYTHONPATH. Select the directories causing the errors and click Remove on the right.

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

2 Comments

This worked for me. In my case I had previously moved the src folder before moving it back to its original place. It kept looking for the temporary location. Make sure you refresh your package explorer
This is the best answer
13

Looks like the problem happens when project name doesn't match directory name.

e.g.,

  • env/VersionModifier/src/myfile.py
  • .project file = CoolTool
  • source folder not found

  • env/VersionModifier/src/myfile.py

  • .project file = VersionModifier
  • OK

You could call it a bug or an "enforcement of best practice" but right clicking on the project and making its name match its enclosing directory fixed the problem for me in Kepler.

Good luck

Peter

2 Comments

I would like to call it a bug.
No, still happens for me even though project name is the same as directory name. Thanks for answering though.
8

the way i resolved it is to go to the folder in which your code is stored and find a file by the name of .pydevproject. It is an invisible file in eclipse/aptana so you may have to do this through cli or file browser. look for a structure that look like <path>path/to/your/file</path> and delete the ones that show errors in your package explorer. this will resolve your problems for now, but this is a bug and needs to be reported.

I think the problem stems from the fact that pydev fails to remove the <path>...</path> vars once the user deletes the source folder.

3 Comments

You may need to refresh the project (F5, or right-click project in pkg-explorer, "Refresh").
I have tried this and Build Project but with no success
I think this is the most correct answer. There are workarounds but it is a bug and I agree that the problem probably has to do with PyDev failing to update PYTHONPATH if a source folder is deleted.
3

Below is how I resolved this, hope it helps.

Clean Up:

  • Removed the project from eclipse; of course, leaving it as on disk.
  • From the source directory removed ".project" and ".pydevproject" files.

Recreate:

  • Created a new PyDev project (in eclipse), providing the existing source directory. In the New Project dialog, selected "Create 'src' folder and add it to the PYTHONPATH". The project got created properly, without any source-folder errors.
  • Now add the folder you want to add as source directory, by right-clicking the folder and selecting the option under "PyDev".
  • At the end, you may just delete the "src" directory that was created by eclipse.

Comments

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.