[wingide-users] Changing Python Path from Script

Wingware Support support at wingware.com
Sun Jan 14 10:47:23 MST 2007


Michael Foord wrote:
>> As John said, the dir of the main script should be added
>> automatically so nothing should be needed here.
> How ?
> 
> If I load the file :
> 
>    c:\Checkout\Main\UnitTests\SomeTest.py
>
> How is 'Main' automatically added to the Python Path ?

The main script is defined as the main debug file in the project, so 
you'd set c:\Checkout\Main\somefile.py as the main debug file and 
c:\Checkout\Main would be added to the python path searched by the IDE 
for autocompletion.

> So every time we do a new checkout we need to create a new project file.
> 
> This is what I meant about dynamically creating/modifying project files.
> 
> We could solve this by having a project file in the main directory - but 
> that means polluting the main directory of our repository. This isn't 
> out of the question.

I'd suggest putting the project under version control so it can be 
shared, updated, reverted, etc.  You'll also have a project file for 
each branch.  References to files are stored as relative names in the 
project file for this purpose.  The project file doesn't need to be in 
the top of your source hierarchy, it can be put it a subdirectory.

When working on another branch, open the project file for that branch. 
One problem with constantly changing the python path as you propose is 
that the IDE is going to display autocomplete choices based on the last 
python path set, so it may use symbols from 
c:\Checkout\BranchYY\somemodule.py even though you're working on the 
main branch.  You can have 2 instances of the IDE open if you need to 
quickly switch back and forth.

Cheers,

John


More information about the wingide-users mailing list