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

Jeff Hardy jdhardy at gmail.com
Sun Apr 26 01:14:51 CEST 2015


It's the sort of error I would expect if there was an assembly version
mismatch, but that usually goes the other way - installed IronPython
breaking embedded/hosted IronPython. Maybe break out fuslogvw and see
which assemblies are being loaded?

As an aside: I'm impressed clrtypes.py works *at all*. I don't think
there are any tests covering it :(

- Jeff

On Fri, Apr 24, 2015 at 8:24 PM, Sebastián Magrí <sebasmagri at gmail.com> wrote:
> 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í
>
> _______________________________________________
> Ironpython-users mailing list
> Ironpython-users at python.org
> https://mail.python.org/mailman/listinfo/ironpython-users
>


More information about the Ironpython-users mailing list