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

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


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í
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20150424/1aec308a/attachment.html>


More information about the Ironpython-users mailing list