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_ironpython.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.GetFileInternal(Object storageUnit, String relativePath) bei Microsoft.Scripting.Silverlight.BrowserVirtualFilesystem.GetFile(Object storageUnit, String relativePath) bei Microsoft.Scripting.Silverlight.BrowserVirtualFilesystem.GetFile(String 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.LoadAssembly(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.

Regards, Kay




_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to