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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Todd Wilder
Sent: Wednesday, March 12, 2008 2:19 PM
To: [email protected]
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
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to