[IronPython] FunctionEnvironment16Dictionary problems with IronPythonStudio

sefirah6990 at katamail.com sefirah6990 at katamail.com
Sun Oct 5 20:25:08 CEST 2008


Hi,
I'm new to IronPythonStudio. I choose this environment in order to create .NET assemblies (dll) from IronPython code and use them into a .NET project (like C#, J# or so).

I've noticed that some conversions between IP code and compiled dll were made by IronPythonStudio compiler, for example the names of every user-defined method change from "methodName" to "MethodName$f19" (a suffix like "$f<random number>" is appended)..no problems about that.

The convertion that is causing me a lot of troubles is about method parameters.
Example: if my init method was:
 __init__(self, n, s, m)
after compilation becomes:
__init__$f0(FunctionEnvironment16Dictionary _env, Object self, Object n, Object s, Object m)

Well, where should i get the correct instance of FunctionEnvironment16Dictionary?

If i create a new object of this type and try to invoke init in this way: (now we are into a C# project)

Student stu2 = new Student();
stu2.__init__$f0(new FunctionEnvironment16Dictionary(), stu2, "hello", "world", "!!!");

the system always throw a NullReferenceException in the second line.. Here is the stack trace:

   at IronPython.Runtime.Calls.FunctionEnvironmentDictionary.get_Module()
   at IronPython.Runtime.Operations.Ops.UpdateTraceBack(ICallerContext context, String filename, Int32 line, String funcName, Boolean& notHandled)
   at Student.__init__$f0(FunctionEnvironment16Dictionary $env, Object self, Object n, Object s, Object m)
   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

Seems that a Module is required but i don't understand what should i do...

Someone could explain where is my mistake?

Thanks a lot!!
Marco
---- Nuova grafica e nuove funzionalità! Crea subito Gratis la tua nuova Casella di Posta  Katamail



More information about the Ironpython-users mailing list