[wingide-users] Access to current project directory?

Wingware Support support at wingware.com
Tue Sep 2 08:49:27 MDT 2008

Tom Stambaugh wrote:
> I organize my files for a given project around its project directory. 
> I'd therefore like to be able to add it to sys.path, something like this:
>>>> theCurrentProjectDirectory = somethingorother.getProjectDirectory()
>>>> sys.path.insert(0, theCurrentProjectDirectory)
> When I'm running under a web server, I do something similar with 
> DOCUMENT_ROOT, but in this case I'm not running under a web server.
> Is there a way from within the IDE to determine the current project 
> directory under IDE control? I'm thinking of some sort of option in the 
> "Python Path" section of the "Environment" tab of the project properties 
> dialog -- something like "Use Project Directory" (in addition to "Use 
> default" and "Custom").

You can add values from the environment to the Python Path with entries
like $(MYENVVARNAME).  However, Wing doesn't set an env with the value
of your project's directory, so you would have to do that yourself
in the Project Properties Environment list.  That of course would
require some maintenance if you've moving your project to different
locations.  On some OSes, it's possible that the env PWD may be
of use although that may not match the project directory if you've
set the Initial Directory under the Debug tab of Project Properties.

Hope that helps...


Stephan Deibel
Wingware | Python IDE
Advancing Software Development


More information about the wingide-users mailing list