Kay, This are a couple bad bugs in the current sources; we desperately need to have better test coverage on embedding IronPython in a C# Silverlight app (hopefully I'll get time for that next month). In the meantime, here are fixed, unsigned binaries: http://github.com/jschementi/orphanage/tree/master/embedding-ipy/Dependencies/. The IronPython and DLR sources should have the fix in the next couple days, and we'll discuss getting these fixes in for 2.6 RTM.
Michael, I finally tracked down what is causing your sub-directory module importing issue: http://blog.jimmy.schementi.com/2009/11/embedding-ironpython-in-silverlight.html In short, an empty file in the XAP file is the same as a non-existent file, so make sure your __init__.py file(s) are not empty. ~js > -----Original Message----- > From: users-boun...@lists.ironpython.com [mailto:users- > boun...@lists.ironpython.com] On Behalf Of Michael Foord > Sent: Tuesday, November 10, 2009 12:25 PM > To: Discussion of IronPython > Subject: Re: [IronPython] Fail to execute "import System" on Silverlight > embedded interpreter > > Kay Schluehr wrote: > > Hi IronPython list, > > > > I worked along Michael Foords introductory article about embedding > > IronPython in Silverlight together with his > > "EmbeddingIronPythonSilverlight" project documented here: > > > > > http://www.voidspace.org.uk/ironpython/silverlight/embedding_ironpytho > > n.shtml > > > > > > I added the following two lines to the source code > > > > source = pe.CreateScriptSourceFromString("import System", > > SourceCodeKind.Statements); source.Execute(scope); > > > > This worked all well with the given built and the shipped assemblies. > > > > Yesterday I downloaded the DLR dlr-34133, built it and replaced the > > assemblies of the "EmbeddingIronPython..." project with the latest > > SilverlightDebug ones. Running the code again I get following import > > error: > > > > System.NullReferenceException wurde nicht von Benutzercode behandelt. > > Message="Der Objektverweis wurde nicht auf eine Objektinstanz > > festgelegt." > > StackTrace: > > bei > > Microsoft.Scripting.Silverlight.DynamicApplication.get_BaseUri() > > bei > > Microsoft.Scripting.Silverlight.DynamicApplication.MakeUri(Uri > > baseUri, Uri relativeUri) > > bei > > Microsoft.Scripting.Silverlight.HttpVirtualFilesystem.GetFileInternal( > > Object > > baseUri, Uri relativeUri) > > bei > > Microsoft.Scripting.Silverlight.BrowserVirtualFilesystem.GetFileIntern > > al(Object > > storageUnit, String relativePath) > > bei > > Microsoft.Scripting.Silverlight.BrowserVirtualFilesystem.GetFile(Objec > > t > > storageUnit, String relativePath) > > bei > > Microsoft.Scripting.Silverlight.BrowserVirtualFilesystem.GetFile(Strin > > g > > relativePath) > > bei Microsoft.Scripting.Silverlight.BrowserPAL.FileExists(String > > path) > > bei > IronPython.Runtime.Importer.LoadModuleFromSource(CodeContext > > context, String name, String path) > > bei > > IronPython.Runtime.Importer.LoadPackageFromSource(CodeContext > context, > > String name, String path) > > bei IronPython.Runtime.Importer.LoadFromDisk(CodeContext > > context, String name, String fullName, String str) > > bei IronPython.Runtime.Importer.ImportFromPathHook(CodeContext > > context, String name, String fullName, List path, Func`5 defaultLoader) > > bei IronPython.Runtime.Importer.ImportFromPath(CodeContext > > context, String name, String fullName, List path) > > bei IronPython.Runtime.Importer.ImportTopAbsolute(CodeContext > > context, String name) > > bei IronPython.Runtime.Importer.ImportModule(CodeContext > > context, Object globals, String modName, Boolean bottom, Int32 level) > > bei IronPython.Modules.Builtin.__import__(CodeContext context, > > String name, Object globals, Object locals, Object fromlist, Int32 > > level) > > InnerException: > > > > > > Apparently, pre-loading assemblies in the loop > > > > foreach (string name in new string[] { "mscorlib", "System", > > "System.Windows", "System.Windows.Browser", "System.Net" }) > > { > > > > > runtime.LoadAssembly(runtime.Host.PlatformAdaptationLayer.LoadAssembl > y > > (name)); > > > > } > > > > had no effect and IronPython attempts to load the 'System' module from > > the disk as a Python module. The standard import routine "import clr; > > clr.AddReference("System"); import System" causes the same problem. > > I'm puzzled. > > I've had horrible problems with imports in Silverlight when using embedded > IronPython and didn't really get any good answers I'm afraid. :-( > > Michael > > > > > Regards, Kay > > > > > > > > > > _______________________________________________ > > Users mailing list > > Users@lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > -- > http://www.ironpythoninaction.com/ > > _______________________________________________ > Users mailing list > Users@lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com