[Ironpython-users] ctypes module in version 2.7.2 can't create Union values

Slide slide.o.mix at gmail.com
Sat Apr 21 00:31:55 CEST 2012


Just a question, is the CPython stdlib in your IRONPYTHONPATH or added
to sys.path?

slide

On Fri, Apr 20, 2012 at 2:18 PM, Dino Viehland <dinov at microsoft.com> wrote:
> I'd suggest running w/ -X:ExceptionDetail and sending back the stack trace that you
> get as that'll tell us where the exception is coming from.
>
>> -----Original Message-----
>> From: ironpython-users-bounces+dinov=microsoft.com at python.org
>> [mailto:ironpython-users-bounces+dinov=microsoft.com at python.org] On
>> Behalf Of mva at sysfault.org
>> Sent: Friday, April 20, 2012 6:46 AM
>> To: ironpython-users at python.org
>> Subject: [Ironpython-users] ctypes module in version 2.7.2 can't create Union
>> values
>>
>> Dear all,
>>
>> on a 64-bit Windows 7 machine (other platforms untested), I find myself unable
>> to create a ctypes.Union-based class wrapper for a C type.
>> Regardless of what kind of Union I create, it always ends up with a "object
>> reference not set to an instance of an object" error from .NET. Find below a
>> brief command line example including the necessary .NET and IronPython
>> information.
>>
>> IronPython 2.7.2.1 (2.7.0.40) on .NET 4.0.30319.261 (32-bit) Type "help",
>> "copyright", "credits" or "license" for more information.
>> >>> from ctypes import *
>> >>> class foo(Union):
>> ...     _fields_ = [("t", c_uint), ("b", c_float)]
>> ...
>> >>> bar = foo()
>> >>> bar.t = 1
>> Traceback (most recent call last):
>>    File "<stdin>", line 1, in <module>
>> SystemError: Object reference not set to an instance of an object.
>>
>> I'm not subscribed to this list, in case you require more information please keep
>> me in CC.
>>
>> Regards
>> Marcus
>>
>> _______________________________________________
>> Ironpython-users mailing list
>> Ironpython-users at python.org
>> http://mail.python.org/mailman/listinfo/ironpython-users
>>
>>
>
>
>
> _______________________________________________
> Ironpython-users mailing list
> Ironpython-users at python.org
> http://mail.python.org/mailman/listinfo/ironpython-users



-- 
Website: http://earl-of-code.com


More information about the Ironpython-users mailing list