[IronPython] Iron Python Question

Dino Viehland dinov at exchange.microsoft.com
Mon Aug 21 20:31:01 CEST 2006

You should be able to do engine.Execute('print myVar2') and it should print out the value you stored into Globals.

You can also create other modules that have different sets of globals and pass the EngineModule to the overload of Execute that takes one of those.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jeff Collett
Sent: Monday, August 21, 2006 5:35 AM
To: users at lists.ironpython.com
Subject: [IronPython] Iron Python Question

Hi All,
I just started using Iron Python and I am bit unsure on the best way to pass data from the app that runs the script and the script itself.
So far I know that we should do something like this from say a C# application,

PythonEngine.Globals["myVar"] = myVar;

So from the looks of this it is a global array for storing data.
Can I do this then,
PythonEngine.Globals["myVar"] = myVar;
PythonEngine.Globals["myVar2"] = myVar2; PythonEngine.Globals["myVar3"] = myVar3;

Then how would I access this data from the script.
Example of which I do not think I can do from the script, myVar = PythonEngine.Globals["myVar"]
myVar2 = PythonEngine.Globals["myVar2"]

Thanks for any advice.

Although this e-mail and any attachments are believed to be free of any virus or other defect which might affect any computer system, it is the responsibility of the recipient to check that it is virus-free and the sender accepts no responsibility or liability for any loss, injury, damage, cost or expense arising in any way from receipt or use thereof by the recipient.

The information contained in this electronic mail message is confidential information and intended only for the use of the individual or entity named above, and may be privileged.  If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.  If you have received this transmission in error, please  contact the sender immediately, delete this material from your computer and destroy all related paper media.  Please note that the documents transmitted are not intended to be binding until a hard copy has been manually signed by all parties.
Thank you.
users mailing list
users at lists.ironpython.com

More information about the Ironpython-users mailing list