Hello guys,

I'm having problems with a C# Silverlight application that hosts IronPython.

First of all, this page http://sdlsdk.codeplex.com/Wiki/View.aspx?title=Hosting implies that the following code should load assemblies for the hosted IronPython code:

foreach (string name in new string[] { "mscorlib", "System", "System.Windows", "System.Windows.Browser", "System.Net" })
           {
               runtime.Host.PlatformAdaptationLayer.LoadAssembly(name);
           }

It doesn't - an import from System.Windows fails. The following code works as in a normal hosted environment:

           runtime.LoadAssembly(typeof(String).Assembly);
           runtime.LoadAssembly(typeof(Uri).Assembly);
           runtime.LoadAssembly(typeof(Canvas).Assembly);

Secondly, which is much worse but may be related, imports from Python files inside the xap fail when IronPython is hosted. I am using the following code:

           ScriptRuntimeSetup setup = Python.CreateRuntimeSetup(null);
setup.HostType = typeof(Microsoft.Scripting.Silverlight.BrowserScriptHost);
           ScriptRuntime runtime = new ScriptRuntime(setup);
           ScriptEngine pe = Python.GetEngine(runtime);
ScriptScope scope = pe.CreateScope(); ScriptSource source = pe.CreateScriptSourceFromString(python_source, SourceCodeKind.Statements);
           source.Execute(scope);

How do I setup the platform adaptation layer so that it can import from inside the xap?

All the best,


Michael

--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog


_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to