Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python26\lib\ctypes\__init__.py", line 17, in <module>
from struct import calcsize as _calcsize
ImportError: cannot import name calcsize
>>> from ctypes import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python26\lib\ctypes\__init__.py", line 17, in <module>
from struct import calcsize as _calcsize
ImportError: cannot import name calcsize
>>>
views:
130answers:
1
+5
A:
It seems you have another struct.py in your path somewhere.
Try this to see where python finds your struct module:
>>> import inspect
>>> import struct
>>> inspect.getabsfile(struct)
'c:\\python26\\lib\\struct.py'
truppo
2009-08-13 08:23:35
Schoolboy error. running cmd.exe was defaulting the CWD to the desktop. Where I had a temp script from a question I asked previously ( http://stackoverflow.com/questions/1264833/python-class-factory-to-produce-simple-struct-like-classes ). I shall remember inspect though. Thank you.
kjfletch
2009-08-13 08:28:21