Hi there everyone,

I have a problem I can't seem to figure out.

I want to use IronPython as an assembly via dotNET, I managed to load it as an assembly and access various constructors, classes etc...

However, I have a problem with executing Python code from the host application. I'm using 3ds Max to load up the assembly via dotNET. The code looks like this:

Assembly = dotNetClass "System.Reflection.Assembly" -- loading the assembly class
Assembly.LoadFrom "C:\IronPython-2.0.1\IronPython.dll" -- loading IronPython

ironPythonHosting = dotNetClass "IronPython.Hosting.Python" -- loading the hosting class
pythonEngine = ironPythonHosting.CreateEngine() -- creating an engine

Now, when I execute:

pythonEngine.ExecuteFile("C:\\tst.py")

it runs smoothly and executes the tst.py and whatever Python code that's inside.

Now, I want to execute the code directly, not via a saved file. I tried this:

pythonEngine.Execute("print 'TEST'")

but it throws me an error:

-- Error occurred in anonymous codeblock; filename: ; position: 344
-- Runtime error: dotNet runtime exception: Late bound operations cannot be performed on types or methods for which ContainsGenericParameters is true.

Also, if I execute the Python code inside a file, is there a way to get the result/feedback from the code back to the host application? Via dotNET or IronPython? Or anyhow? So that I can write more complex tools that'd communicate with Pyhon code from within 3ds Max.

Thanks a lot in advance, cheers,

- Lukas Dubeda
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to