Eclipse path variables problem

2010-08-23
2013-03-15
  • I need to use an external source library and add it to my PYTHONPATH in a way that allows the .pydevproject file to be checked into an SCM and used in multiple workspaces on different computers where the path to the external source directory varies.

    What I did was to create an Eclipse path variable in Windows->Preferences->General->Workspace->Linked Resources. Then in the PyDev - PYTHONPATH project properties page on the External Libraries tab I added a path using the "Add based on variable" button and entering ${MY_VARIABLE} where MY_VARIABLE was the name of the path variable I defined earlier.

    However, the Pydev Package Explorer view shows an Eclipse error with the following text:
    Invalid external source folder specified: ${MY_VARIABLE}. Am I doing something wrong or is there a potential problem with Pvdev or Eclipse as it looks as if Eclipse is not expanding the variable even though it is stored in .pydevproject.

    I am running on Eclipse 3.6 with Pydev 1.6.1 running on Ubuntu 10.04

    Here is the contents of .pydevproject

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <?eclipse-pydev version="1.0"?>
    <pydev_project>
    <pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">python</pydev_property>
    <pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.6</pydev_property>
    <pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
    <path>/test/src</path>
    </pydev_pathproperty>
    <pydev_pathproperty name="org.python.pydev.PROJECT_EXTERNAL_SOURCE_PATH">
    <path>${PYMT_SOURCE}</path>
    </pydev_pathproperty>
    </pydev_project>
    
     
  • Editing error: PYMT_SOURCE = MY_VARAIBLE

     
  • Nitko Nigdje
    Nitko Nigdje
    2011-01-12

    Same problem here. Variables like WORKSPACE_LOC or similar are unknown to "PyDev - PYTHONPATH" properties tab.

    Using Eclipse Helios Service Release 1 (eclipse-jee-helios-win32-x86_64), Build id: 20100917-0705
    PyDev: 1.6.4.2011010200
    JVM: java version "1.6.0_23", Java HotSpot(TM) 64-Bit Server VM (build 19.0-b09, mixed mode)
    OS: Windows 7 x64

     
  • Fabio Zadrozny
    Fabio Zadrozny
    2011-01-13

    Sorry for missing this thread before… yes, pydev does not support the variables defined in eclipse for now. It only supports the variables defined at 'String substitution variables', which may be configured either at the project properties: "Pydev-Pythonpath >Stringt substitution variables" (but that defeats the purpose of having it defined in the first place as it'd still be committed) or at the interpreter configuration: "window > preferences > Pydev > Interpreter - Python" (which is the proper solution for your case, and it has the benefit of providing a way to have variables that are not only workspace dependent, but also interpreter dependent).

    Cheers,

    Fabio