[IronPython] IronPython & Silverlight

Craig S. Perler 04 Craig.S.Perler.04 at Alum.Dartmouth.ORG
Tue Jan 22 05:31:23 CET 2008


Hello,

I'm having problems accessing .NET libraries from 
IronPython hosted within a Silverlight application and 
have hit a wall. If you have any advice, I'd be most 
appreciative!

To describe my setup... I'm first initializing the 
PlatformAdaptationLayer with the details described here 
[http://www.voidspace.org.uk/ironpython/silverlight/embeddi
ng_ironpython.shtml]. I'm not certain what exactly that 
does, but it seems clear that no amount of fiddling around 
in IronPython works without detailing the 
ScriptEnvironmentSetup. With that in place, I see a bit of 
progress: I can execute the script "def func():\r\n 
return 'in Func()'" and then retrieve the result by 
evaluating the script "func()". 

I've tried a variety of combinations to gain access to 
System.DateTime from the Python script, but they all end 
up with an error like the one below. Additionally, this 
error is also similar to the one I receive when attempting 
to call PythonEngine.ExecuteFile(string path), which I 
have thus far been unable to get to work.

Any thoughts?  Please let me know if you need more details 
to help me debug!

Thanks in advance,

-Craig

************************************* 

A first chance exception of 
type 'System.NotImplementedException' occurred in Unknown 
Module.

System.NotImplementedException: The method or operation is 
not implemented.

at 
Microsoft.Scripting.Hosting.PlatformAdaptationLayer.OpenInp
utFileStream(String path)

at Microsoft.Scripting.SourceFileUnit.OpenStream()

at Microsoft.Scripting.SourceFileUnit.GetReader()

at IronPython.Compiler.Parser.CreateParser(CompilerContext 
context, PythonEngineOptions options, Boolean verbatim)

at IronPython.Compiler.Parser.CreateParser(CompilerContext 
context, PythonEngineOptions options)

at 
IronPython.Compiler.Generation.PythonScriptCompiler.ParseFi
le(CompilerContext cc)

at Microsoft.Scripting.SourceFileUnit.Parse
(CompilerContext compilerContext)

at Microsoft.Scripting.SourceUnit.Compile(CompilerOptions 
options, ErrorSink errorSink)

at Microsoft.Scripting.SourceUnit.CompileToModule
(CompilerOptions options, ErrorSink errorSink)

at Microsoft.Scripting.SourceUnit.CompileToModule()

at IronPython.Runtime.Importer.LoadFromSourceUnit
(SourceFileUnit sourceUnit)

at IronPython.Runtime.Importer.LoadModuleFromSource
(CodeContext context, String name, String path)

at IronPython.Runtime.Importer.ImportFromPath(CodeContext 
context, String name, String fullName, List path)

at IronPython.Runtime.Importer.ImportTopAbsolute
(CodeContext context, String name)

at IronPython.Runtime.Importer.ImportModule(CodeContext 
context, String modName, Boolean bottom)

at IronPython.Runtime.Builtin.Import(CodeContext context, 
String name, Object globals, Object locals, Object 
fromList)

at Import##7(CodeContext , Object , Object , Object , 
Object )

at Microsoft.Scripting.FastCallableWithContextAny.Call
(CodeContext context, Object arg0, Object arg1, Object 
arg2, Object arg3)

at Microsoft.Scripting.FastCallableWithContextAny.Call
(CodeContext context, Object[] args)

at Microsoft.Scripting.BuiltinFunction.Call(CodeContext 
context, Object[] args)

at IronPython.Runtime.Operations.Ops.CallWithContext
(CodeContext context, Object func, Object[] args)

at IronPython.Runtime.Importer.Import(CodeContext context, 
String fullName, List from)

at IronPython.Runtime.PythonOps.ImportWithNames
(CodeContext context, String fullName, String[] names)

at <string##12(Object[] , CodeContext )

at Microsoft.Scripting.ScriptCode.Run(CodeContext 
codeContext)

at Microsoft.Scripting.ScriptCode.Run(ScriptModule module)

at Microsoft.Scripting.Hosting.CompiledCode.Evaluate
(IScriptModule module)

at Microsoft.Scripting.Hosting.CompiledCode.Execute
(IScriptModule module)

at Microsoft.Scripting.Hosting.ScriptEngine.Execute(String 
code, IScriptModule module)

at Microsoft.Scripting.Hosting.ScriptEngine.Execute(String 
code)

at MyApp.Scripting.ScriptEngine.Execute(String script)



More information about the Ironpython-users mailing list