[IronPython] Regression with importing in pre b5

Dan Eloff dan.eloff at gmail.com
Sat Sep 6 02:16:16 CEST 2008


I'm going to make a lot of work for you guys before the day is out :)
Maybe I should be posting these to the Issue Tracker? I'm just
concerned they will get lost in the noise.

Using sdlsdk version. It seems there are some circumstances where

from pkg.module import foo

Fails in pkg/__init__.py. In fact it fails by attempting to reimport
__init__.py, including executing the module level code a second time
(this can make the error very misleading if this code is not able to
be run twice!)

-Dan

Full trace as follows:

Line 42: from templates.galaxy_map import GalaxyMap

at game\templates\__init__.py in game\templates\__init__.py, line 42
at game\templates\__init__.py in game\templates\__init__.py, line 42
at game\interface.py in game\interface.py, line 1
at game\__init__.py in game\__init__.py, line 14
at startup in app.py, line 79
at app.py in app.py, line 86
CLR Stack Trace:
   at IronPython.Runtime.Builtin.__import__(CodeContext context,
String name, Object globals, Object locals, Object fromlist, Int32
level)
   at _stub_$461##170(Closure , CallSite , CodeContext , Object ,
String , IAttributesCollection , IAttributesCollection , PythonTuple ,
Int32 )
   at IronPython.Runtime.Importer.Import(CodeContext context, String
fullName, PythonTuple from, Int32 level)
   at IronPython.Runtime.Operations.PythonOps.ImportWithNames(CodeContext
context, String fullName, String[] names, Int32 level)
   at S$59.Initialize(Scope $scope, LanguageContext $language)
   at Microsoft.Scripting.Runtime.OptimizedScriptCode.InvokeTarget(LambdaExpression
code, Scope scope)
   at Microsoft.Scripting.ScriptCode.Run(Scope scope)
   at IronPython.Runtime.PythonContext.CreateModule(String fileName,
Scope scope, ScriptCode scriptCode, ModuleOptions options)
   at IronPython.Runtime.PythonContext.CompileModule(String fileName,
String moduleName, SourceUnit sourceCode, ModuleOptions options,
ScriptCode& scriptCode)
   at IronPython.Runtime.PythonContext.CompileModule(String fileName,
String moduleName, SourceUnit sourceCode, ModuleOptions options)
   at IronPython.Runtime.Importer.LoadFromSourceUnit(CodeContext
context, SourceUnit sourceCode, String name, String path)
   at IronPython.Runtime.Importer.LoadModuleFromSource(CodeContext
context, String name, String path)
   at IronPython.Runtime.Importer.LoadPackageFromSource(CodeContext
context, String name, String path)
   at IronPython.Runtime.Importer.ImportFromPath(CodeContext context,
String name, String fullName, List path)
   at IronPython.Runtime.Importer.ImportNestedModule(CodeContext
context, Scope scope, String name, List path)
   at IronPython.Runtime.Importer.ImportFrom(CodeContext context,
Object from, String name)
   at IronPython.Runtime.Operations.PythonOps.ImportFrom(CodeContext
context, Object module, String name)
   at S$37.Initialize(Scope $scope, LanguageContext $language)
   at Microsoft.Scripting.Runtime.OptimizedScriptCode.InvokeTarget(LambdaExpression
code, Scope scope)
   at Microsoft.Scripting.ScriptCode.Run(Scope scope)
   at IronPython.Runtime.PythonContext.CreateModule(String fileName,
Scope scope, ScriptCode scriptCode, ModuleOptions options)
   at IronPython.Runtime.PythonContext.CompileModule(String fileName,
String moduleName, SourceUnit sourceCode, ModuleOptions options,
ScriptCode& scriptCode)
   at IronPython.Runtime.PythonContext.CompileModule(String fileName,
String moduleName, SourceUnit sourceCode, ModuleOptions options)
   at IronPython.Runtime.Importer.LoadFromSourceUnit(CodeContext
context, SourceUnit sourceCode, String name, String path)
   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.ImportNestedModule(CodeContext
context, Scope scope, String name, List path)
   at IronPython.Runtime.Importer.ImportModuleFrom(CodeContext
context, Object from, String name)
   at IronPython.Runtime.Importer.ImportModule(CodeContext context,
Object globals, String modName, Boolean bottom, Int32 level)
   at IronPython.Runtime.Builtin.__import__(CodeContext context,
String name, Object globals, Object locals, Object fromlist, Int32
level)
   at IronPython.Runtime.Builtin.__import__(CodeContext context,
String name, Object globals, Object locals, Object fromlist)
   at _stub_$12##2(Closure , CallSite , CodeContext , Object , String
, IAttributesCollection , IAttributesCollection , PythonTuple )
   at IronPython.Runtime.Importer.Import(CodeContext context, String
fullName, PythonTuple from, Int32 level)
   at IronPython.Runtime.Operations.PythonOps.ImportWithNames(CodeContext
context, String fullName, String[] names, Int32 level)
   at S$9.Initialize(Scope $scope, LanguageContext $language)
   at Microsoft.Scripting.Runtime.OptimizedScriptCode.InvokeTarget(LambdaExpression
code, Scope scope)
   at Microsoft.Scripting.ScriptCode.Run(Scope scope)
   at IronPython.Runtime.PythonContext.CreateModule(String fileName,
Scope scope, ScriptCode scriptCode, ModuleOptions options)
   at IronPython.Runtime.PythonContext.CompileModule(String fileName,
String moduleName, SourceUnit sourceCode, ModuleOptions options,
ScriptCode& scriptCode)
   at IronPython.Runtime.PythonContext.CompileModule(String fileName,
String moduleName, SourceUnit sourceCode, ModuleOptions options)
   at IronPython.Runtime.Importer.LoadFromSourceUnit(CodeContext
context, SourceUnit sourceCode, String name, String path)
   at IronPython.Runtime.Importer.LoadModuleFromSource(CodeContext
context, String name, String path)
   at IronPython.Runtime.Importer.LoadPackageFromSource(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,
Object globals, String modName, Boolean bottom, Int32 level)
   at IronPython.Runtime.Builtin.__import__(CodeContext context,
String name, Object globals, Object locals, Object fromlist, Int32
level)
   at IronPython.Runtime.Builtin.__import__(CodeContext context,
String name, Object globals, Object locals, Object fromlist)
   at _stub_$12##2(Closure , CallSite , CodeContext , Object , String
, IAttributesCollection , IAttributesCollection , PythonTuple )
   at IronPython.Runtime.Importer.Import(CodeContext context, String
fullName, PythonTuple from, Int32 level)
   at IronPython.Runtime.Operations.PythonOps.ImportTop(CodeContext
context, String fullName, Int32 level)
   at S$1.startup$10()
   at _stub_$297##139(Closure , CallSite , CodeContext , Object )
   at System.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4
target, CallSite site, Object[] args)
   at System.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args)
   at System.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite
site, T0 arg0, T1 arg1)
   at S$1.Initialize(Scope $scope, LanguageContext $language)
   at Microsoft.Scripting.Runtime.OptimizedScriptCode.InvokeTarget(LambdaExpression
code, Scope scope)
   at Microsoft.Scripting.ScriptCode.Run(Scope scope)
   at Microsoft.Scripting.Hosting.CompiledCode.Execute()
   at Microsoft.Scripting.Silverlight.DynamicApplication.StartMainProgram()
   at Microsoft.Scripting.Silverlight.DynamicApplication.DynamicApplication_Startup(Object
sender, StartupEventArgs e)
   at System.Windows.CoreInvokeHandler.InvokeEventHandler(Int32
typeIndex, Delegate handlerDelegate, Object sender, Object args)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr
unmanagedObjArgs, Int32 argsTypeIndex, String eventName)



More information about the Ironpython-users mailing list