[IronPython] with_statement in IronPython 2.6 Alpha

Lepisto, Stephen P stephen.p.lepisto at intel.com
Thu May 21 16:04:51 CEST 2009


Elise,

PYTHONPATH is an environment variable and can be set on Windows by going to Control Panel --> System.  Select the Advanced tab then click on the Environment Variables button.  In the lower pane, click the New button and enter PYTHONPATH for the Variable name and enter the path or paths you want in the Variable value.  Use semi-colons to separate multiple paths.  Click OK, click OK, and click OK to exit.

Note: Visual Studio needs to be closed then reopened for it to recognize the new environment variable (this is true for Visual Studio 2005 and earlier, I actually haven't tested Visual Studio 2008 to see if it properly responds to a change in environment variables).

As for adding a reference to an assembly from IronPython, I found good success with using AddReference() with sys.path.append() instead of AddReferenceToFile().  For example,

sys.path.append(r"C:\Users\i-ellang\Documents\Infer.NET2.2\bin\Debug")
clr.AddReference("Infer.Compiler")
clr.AddReference("Infer.Runtime")


From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Elise Langham (Elanit)
Sent: Thursday, May 21, 2009 4:23 AM
To: users at lists.ironpython.com
Subject: Re: [IronPython] with_statement in IronPython 2.6 Alpha

Hi Dave,
                 Thanks for the reply- I'm running in the Visual Studio under debug. I don't know how to set pythonpath on a windows machine
Most of the info is for C shell and linux. I find that the with statement works fine when just using the command line ipy.exe but it can't pick up
The references to imported modules. The references work fine when running in Visual Studio though ????

import System
from System import Console
from System import Array
from System import IO
import clr
import sys
sys.path.append(r"C:\Users\i-ellang\Documents\Infer.NET2.2\bin\Debug")
clr.AddReferenceToFile("Infer.Compiler.dll")
clr.AddReferenceToFile("Infer.Runtime.dll")

think this only works when the .dlls are in the IronPython ipy.exe directory though.
 'C:\\Users\\i-ellang\\IronPython 2.6'

Hope you can help,

Elise
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20090521/8705f228/attachment.html>


More information about the Ironpython-users mailing list