[IronPython] Visual Studio Interactive Shell Search Path:
Dino Viehland
dinov at microsoft.com
Fri Jan 28 18:31:53 CET 2011
Federico wrote:
> When testing a script using the IronPython interactive window in Visual Studio,
> the path variable in system.sys is a bunch of meaningless
> directories:
>
> > import sys
> > sys.path
> ['.', 'C:\\PROGRAM FILES (X86)\\MICROSOFT VISUAL STUDIO
> 10.0\\COMMON7\\IDE\\EXTENSIONS\\MICROSOFT\\IRONSTUDIO\\0.4\\Lib',
> 'C:\\PROGRAM FILES (X86)\\MICROSOFT VISUAL STUDIO
> 10.0\\COMMON7\\IDE\\EXTENSIONS\\MICROSOFT\\IRONSTUDIO\\0.4\\DLLs']
> >
>
> when I do the same operation in the IronPython console outside of Visual
> Studio, I get this:
>
> IronPython 2.7 Beta 1 (2.7.0.10) on .NET 4.0.30319.1 Type "help", "copyright",
> "credits" or "license" for more information.
> >>> import sys
> >>> sys.path
> ['.', 'C:\\Windows\\system32', 'C:\\Program Files (x86)\\IronPython 2.7\\Lib', '
> C:\\Python27\\Lib\\site-packages', 'C:\\Python27\\Lib',
> 'C:\\Windows\\system32',
> 'C:\\Program Files (x86)\\IronPython 2.7\\DLLs', 'C:\\Program Files (x86)\\Iron
> Python 2.7'] >>>
>
> when I do the same operation in Visual Studio, just executing a script (not in the
> interactive mode) I get this:
>
> ['C:\\Users\\FedeV\\Documents\\Systems Biology\\Fission Yeast\\Network
> Analysis\ \Source Code', '.', 'C:\\Users\\FedeV\\Documents\\Systems
> Biology\\Fission Yeast
> \\Network Analysis\\Source Code', 'C:\\Program Files (x86)\\IronPython
> 2.7\\Lib'
> , 'C:\\Python27\\Lib\\site-packages', 'C:\\Python27\\Lib', 'C:\\Users\\FedeV\\Do
> cuments\\Systems Biology\\Fission Yeast\\Network Analysis\\Source Code',
> 'C:\\Pr ogram Files (x86)\\IronPython 2.7\\DLLs', 'C:\\Program Files
> (x86)\\IronPython 2 .7'] Press any key to continue . . .
>
> I have set up an IRONPYTHONPATH variable in Windows, it seems that the
> interactive visual studio shell fails to import the proper path variable. Other
> than appending the correct directories to sys.path anyone know any 'proper'
> fix?
If you reset the REPL window with your project window do you get the paths
of your project? What I think may be happening here is that when you first
start VS you don't have a project open but you do have the REPL open. The REPL
is therefore created and is running inside of Visual Studio's directory. But when
the REPL is created w/ a project open it'll property pick up the projects settings
for where to start the REPL.
You can also try "Debug-> Execute in Interactive Window" which should reset
the REPL and set it up properly.
More information about the Ironpython-users
mailing list