[IronPython] Access to CLR System namespace when python is executed inside C#
Dino Viehland
dinov at exchange.microsoft.com
Wed Mar 12 23:14:17 CET 2008
What's likely happening is that you're getting a different ScriptEnvironment than the one which "normal" script code is running under. You could get the current runtime by:
Microsoft.Scripting.Silverlight.DynamicApplication.Current.Environment
And then use that because it'll already have System.dll loaded. Alternately you can add the references yourself:
ScriptEnvironment.GetEnvironment().LoadAssembly(typeof(string).Assembly); // mscorlib
ScriptEnvironment.GetEnvironment().LoadAssembly(typeof(System.Diagnostics.Debug).Assembly); // System.dll
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Todd Wilder
Sent: Wednesday, March 12, 2008 2:19 PM
To: users at lists.ironpython.com
Subject: [IronPython] Access to CLR System namespace when python is executed inside C#
I am struggling to get IP to honor the System module when the IP is executed inside C#. I am using Silverlight 2.0 Beta 1. I have the following code.
ScriptEnvironment.GetEnvironment().ExecuteSourceUnit(PythonEngine.CurrentEngine.CreateScriptSourceFromString(@"
import clr
import System", SourceCodeKind.File)); <-- I've also tried SourceCodeKind.Statements and SourceCodeKind.InteractiveCode
This code throws a "The method or operation is not implemented" exception. It seems that any reference to System or any of its classes throws the exception. I was hoping to have my custom assemblies executing in IP through C# by now, and I can't even get the CLR assemblies to execute. Please Help!
Todd Wilder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080312/2bf9be9f/attachment.html>
More information about the Ironpython-users
mailing list