Curt Hagenlocher wrote:
This is a PowerShell error. The DLR hosting interfaces overload Execute (and other methods) with generic and non-generic versions, and it appears that PowerShell won't allow calling of the generic version. For this to work, you'll need to find a way to force PowerShell to use the non-generic overload. I'm afraid my PS skills aren't up to that task.


This topic is covered in IronPython in Action. :-)

I get round the problem using Lee Holmes script that uses reflection for calling generic methods:

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

All the best,

Michael Foord

On Tue, Dec 30, 2008 at 12:39 PM, Stephen Ng <step...@theleengs.com <mailto:step...@theleengs.com>> wrote:

    Thanks, dropping all the dlls from the IronPython2 directory into
    the GAC gets me a little further (adding to the path didn't work).
     Sorry to need to be led by the hand...now I get:

    PS C:\Program Files\IronPython 2.0>
    [reflection.assembly]::loadFrom("C:\Program Files\IronPython
    2.0\IronPython.dll")

    GAC    Version        Location
    ---    -------        --------
True v2.0.50727 C:\WINDOWS\assembly\GAC_MSIL\IronPython\2.0.0.0__31bf3...

    PS C:\Program Files\IronPython 2.0> $py =
    [IronPython.Hosting.Python]::CreateEngine()
    PS C:\Program Files\IronPython 2.0> $py.Execute("3")
    Exception calling "Execute" with "1" argument(s): "Late bound
    operations cannot
     be performed on types or methods for which
    ContainsGenericParameters is true."
    At line:1 char:12
    + $py.Execute( <<<< "3")
    PS C:\Program Files\IronPython 2.0> $py.Execute("print 'hello
    world!'")
    Exception calling "Execute" with "1" argument(s): "Late bound
    operations cannot be performed on types or methods for which
    ContainsGenericParameters is true."
    At line:1 char:12
    + $py.Execute( <<<< "print 'hello world!'")



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


------------------------------------------------------------------------

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


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


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

Reply via email to