Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete source folder in PyDev project generates error "Source folder not found"

Tags:

pydev

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.

like image 637
billie Avatar asked Apr 22 '13 14:04

billie


3 Answers

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

like image 103
tsirig Avatar answered Nov 19 '22 03:11

tsirig


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

like image 13
Peter Kahn Avatar answered Nov 19 '22 05:11

Peter Kahn


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.

like image 8
zer0 Avatar answered Nov 19 '22 05:11

zer0