[IronPython] IronPython integration via dotNET

Michael Foord fuzzyman at voidspace.org.uk
Fri Oct 23 00:38:41 CEST 2009


Lukas Dubeda wrote:
> [snip...]
> -- unfortunately this is where I hit the major road block
> -- when I try to execute the following code block:
> src.execute(scope)
>
> I get the following error:
>
> -- Runtime error: dotNet runtime exception: Late bound operations 
> cannot be performed on types or methods for which 
> ContainsGenericParameters is true.
>

ScriptSource.Execute is a generic method. Attempting to call generic 
methods like this using reflection (which presumably is what Max is 
doing) causes this kind of error. You have the same problem in 
Powershell - here's an example from Lee Holmes of how he solved it in 
Powershell:

    
http://www.leeholmes.com/blog/InvokingGenericMethodsOnNonGenericClassesInPowerShell.aspx

(Note that you will have to change 'P' in the 'Print' from your example 
code to 'p' (lowercase) for it to work anyway.)

All the best,

Michael Foord
>
> I have absolutely no idea how to get around this issue and how to get 
> IronPython execute the Python code and return whatever it calculates
> back to the application I'm running it from so I could catch the return
> and use the values from within Max.
>
> Anyone has any idea?
>
> I should also mention that MAXScript is a dynamic scripting language
> within 3ds Max and that, even though I know MXS quite well as well as
> I know Python and have done tons of scripts and tools with these
> languages, I'm not a programmer, I'm a technical artist (as the official
> title says :) ).
>
> Thanks a lot in advance, I'll appretiate any tips and hints on this
> issue.
>
> - Lukas
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


-- 
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog





More information about the Ironpython-users mailing list