[IronPython] Some More Newbie Questions

Dino Viehland dinov at microsoft.com
Tue May 11 22:50:46 CEST 2010


Matt Funke:
> In IronPython Tools for Visual Studio 2010, how do you make it clear
> where the location of a file to be included is?  I have this line that
> trips up the execution:
> 
> from avalon import *
> 
> ... even though avalon.py is in the same directory, and that directory
> is pointed to by the Search Path.  It throws an ImportError, insisting
> that there is "No module named avalon".  Is there some other thing I
> need to point at this that I'm missing?

How are you launching the app?  Is it via the interactive window or are you
doing a start w/ or w/o debugger?  It looks like we don't set the path in
the interactive window but we do otherwise. 

Of course being in the same directory (as the start file) should mean
that it's available for import anyway.  If you could do:

import System
import sys
print System.Environment.CurrentDirectory, sys.path

and see if those values are the correct dir for your project and include
the directories you've setup in the search path.

I'm also not sure how I feel about setting the search path via the UI
in general.  I'm a little concerned that it'll make it too easy to create
scripts that work when launched in VS but not outside of VS.  So if anyone
has any feedback on how this should be handled I'd love to hear it.





More information about the Ironpython-users mailing list