[Ironpython-users] Error running standalone exe using clrtype.py if IronPython is not installed

Sebastián Magrí sebasmagri at gmail.com
Fri Apr 24 21:24:20 CEST 2015


I'm using pyc.py with and a StdLib.dll, and other DLL dependencies. The
clrtype.py file is passed as an extra file to the pyc command.

   $ ipy pyc.py /standalone /target:winexe /out:myapp /main:app.py ...
clrtype.py

Regards,

2015-04-24 14:29 GMT-04:30 Slide <slide.o.mix at gmail.com>:

> How are you creating your exe?
>
> On Fri, Apr 24, 2015, 11:55 Sebastián Magrí <sebasmagri at gmail.com> wrote:
>
>> Hi!
>>
>> I'm using clrtype.py to do some user32.dll integration and I'm creating a
>> standalone .exe which uses this integration.
>>
>> When I run the .exe on a machine with IronPython installed, it works
>> flawlesly. However, If I run the .exe on a machine without IronPython, then
>> the I get a ValueError. The traceback of the error takes me to clrtype's
>> ClrClass.set_python_type_field() method:
>>
>> ---
>> Traceback (most recent call last):
>>   ...snip...
>>   File "clrtype", line 555, in __clrtype__
>>   File "clrtype", line 176, in create_type
>>   File "clrtype", line 536, in map_members
>>   File "clrtype", line 504, in set_python_type_field
>> ValueError: Object of type
>> 'IronPython.NewTypes.IronPython.Runtime.Types.PythonType_3$3' cannot be
>> converted to type 'IronPython.Runtime.Types.PythonType'.
>> ---
>>
>> The class using the ClrClass metaclass is implemented as follows:
>>
>> ---
>> class NativeMethods(object):
>>     __metaclass__ = clrtype.ClrClass
>>     _clrnamespace = 'my.custom.namespace'
>>
>>     dll_import = clrtype.attribute(DllImportAttribute)
>>     preserve_sig = clrtype.attribute(PreserveSigAttribute)
>>
>>     @staticmethod
>>     @dll_import('user32.dll')
>>     @preserve_sig()
>>     @clrtype.accepts(int, int)
>>     @clrtype.returns(bool)
>>     def ShowWindow(hwnd, flag):
>>         raise RuntimeError('what are you doing here')
>>
>>     @staticmethod
>>     @dll_import('user32.dll')
>>     @preserve_sig()
>>     @clrtype.accepts(int, int, int, int, int, int, int)
>>     @clrtype.returns(bool)
>>     def SetWindowPos(hwnd, insert_after_hwnd, x, y, w, h, flags):
>>         raise RuntimeError('what are you doing here')
>> ---
>>
>> I've been digging into this error and even looking at
>> IronPython.Runtime.Types but I've not found the possible cause of the issue.
>>
>> Is there anything I'm missing here?
>>
>> Best Regards,
>>
>> --
>> Sebastián Ramírez Magrí
>>  _______________________________________________
>> Ironpython-users mailing list
>> Ironpython-users at python.org
>> https://mail.python.org/mailman/listinfo/ironpython-users
>>
>


-- 
Sebastián Ramírez Magrí
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20150424/a1b7620f/attachment.html>


More information about the Ironpython-users mailing list