[IronPython] Visual Studio Interactive Shell Search Path:

Federico Vaggi vaggi at cosbi.eu
Fri Jan 28 18:39:47 CET 2011


  Opening visual studio with no project open, and running the Ironpython 
interactive window, gives me this:

» 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']
»

Making a dummy project, then running it via the debug command in 
interactive mode, gives me this:

Running c:\users\fedev\documents\visual studio 
2010\Projects\ConsoleApplication1\ConsoleApplication1\Program.py
Remote process has been reset...
['.', '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']
»

It doesn't appear that having a project open fixes it.  Where does the 
interactive window pick up its path from anyway?  Or is it hardcoded?

Federico

On 28/01/2011 18:31, Dino Viehland wrote:
> 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.
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com




More information about the Ironpython-users mailing list