Issue1554

classification
Title: ctypes module has no attribute '__version__'
Type: behaviour Severity: normal
Components: Library Versions: 2.5.1
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: thijs, wmeissner
Priority: Keywords:

Created on 2010-02-09.17:44:58 by thijs, last changed 2010-03-20.00:35:35 by pjenvey.

Messages
msg5517 (view) Author: Thijs Triemstra (thijs) Date: 2010-02-09.17:44:56
Currently the Twisted Jython buildslave dies with the following error message (see full log on http://buildbot.twistedmatrix.com/builders/ubuntu64-jython2.5-select/builds/69/steps/shell/logs/stdio):

expr: warning: unportable BRE: `^/': using `^' as the first character
of the basic regular expression is not portable; it is being ignored
missing OpenSSL No module named OpenSSL
missing Crypto No module named Crypto
missing gmpy No module named gmpy
missing SOAPpy No module named SOAPpy
found ctypes, ctypes.__version__ =
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<string>", line 19, in <module>
AttributeError: 'module' object has no attribute '__version__'

So normally ctypes.__version__ is available, as this Python 2.5 session shows:

Python 2.5.4 (r254:67916, Dec 25 2008, 15:04:44) 
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> dir(ctypes)
['ARRAY', 'ArgumentError', 'Array', 'BigEndianStructure', 'CDLL', 'CFUNCTYPE', 'DEFAULT_MODE', 'LibraryLoader', 'LittleEndianStructure', 'POINTER', 'PYFUNCTYPE', 'PyDLL', 'RTLD_GLOBAL', 'RTLD_LOCAL', 'SetPointerType', 'Structure', 'Union', '_CFuncPtr', '_FUNCFLAG_CDECL', '_FUNCFLAG_PYTHONAPI', '_Pointer', '_SimpleCData', '__builtins__', '__doc__', '__file__', '__name__', '__path__', '__version__', '_c_functype_cache', '_calcsize', '_cast', '_cast_addr', '_check_size', '_ctypes_version', '_dlopen', '_endian', '_memmove_addr', '_memset_addr', '_os', '_pointer_type_cache', '_string_at', '_string_at_addr', '_sys', '_wstring_at', '_wstring_at_addr', 'addressof', 'alignment', 'byref', 'c_buffer', 'c_byte', 'c_char', 'c_char_p', 'c_double', 'c_float', 'c_int', 'c_int16', 'c_int32', 'c_int64', 'c_int8', 'c_long', 'c_longlong', 'c_short', 'c_size_t', 'c_ubyte', 'c_uint', 'c_uint16', 'c_uint32', 'c_uint64', 'c_uint8', 'c_ulong', 'c_ulonglong', 'c_ushort', 'c_void_p', 'c_voidp', 'c_wchar', 'c_wchar_p', 'cast', 'cdll', 'create_string_buffer', 'create_unicode_buffer', 'memmove', 'memset', 'pointer', 'py_object', 'pydll', 'pythonapi', 'resize', 'set_conversion_mode', 'sizeof', 'string_at', 'wstring_at']
>>> ctypes.__version__
'1.0.3'

But Jython doesn't have the __version__ property:

Jython 2.5.1+ (trunk:6976, Feb 8 2010, 12:04:59) 
[Java HotSpot(TM) 64-Bit Server VM (Sun Microsystems Inc.)] on java1.5.0_06
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> dir(ctypes)
['CDLL', 'LibraryLoader', 'POINTER', 'Structure', 'Union', '_AggregateMetaClass', '_ArrayCData', '_CData', '_CTypeMetaClass', '_Function', '_ScalarCData', '_StructLayoutBuilder', '_StructMetaClass', '_TypeMap', '_UnionMetaClass', '__doc__', '__file__', '__name__', '__path__', '_pointer_type_cache', 'addressof', 'alignment', 'byref', 'c_bool', 'c_byte', 'c_char_p', 'c_double', 'c_float', 'c_int', 'c_int16', 'c_int32', 'c_int64', 'c_int8', 'c_long', 'c_longlong', 'c_short', 'c_size_t', 'c_ssize_t', 'c_ubyte', 'c_uint', 'c_uint16', 'c_uint32', 'c_uint64', 'c_uint8', 'c_ulong', 'c_ulonglong', 'c_ushort', 'c_void_p', 'cdll', 'jffi', 'memmove', 'memset', 'pointer', 'sizeof']
>>> ctypes.__version__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute '__version__'

This issue prevents Twisted from running it's test suite on the buildslave.
msg5520 (view) Author: Wayne Meissner (wmeissner) Date: 2010-02-12.21:56:19
ctypes.__version__ added in r6977.
msg5532 (view) Author: Thijs Triemstra (thijs) Date: 2010-02-15.18:35:45
Thanks guys, that fixed it, please close this ticket.

Jython 2.5.1+ (trunk:6980, Feb 15 2010, 19:03:47) 
[Java HotSpot(TM) 64-Bit Server VM (Sun Microsystems Inc.)] on java1.5.0_06
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> ctypes.__version__
'0.0.1'
History
Date User Action Args
2010-03-20 00:35:35pjenveysetstatus: open -> closed
resolution: fixed
2010-02-15 18:35:45thijssetmessages: + msg5532
2010-02-12 21:56:20wmeissnersetnosy: + wmeissner
messages: + msg5520
2010-02-09 17:44:58thijscreate