Python 2.6 - ctypes (specifically _ctypes) cannot be imported - Eclipse pydev integration broken as a result

2010-06-23 Thread Kay Drangmeister

Hi.

I updated cygwin a day ago and thus upgraded from python 2.5 to python 2.6.
Now the eclipse integration (pydev plugin) does no longer work correctly,
I drilled down the problem to the issue that ctypes cannot be imported
correctly. (This worked with python 2.5.)

(Starting up a cygwin-bash)
$ python
Python 2.6.5 (r265:79063, Jun 12 2010, 17:07:01)
[GCC 4.3.4 20090804 (release) 1] on cygwin
Type help, copyright, credits or license for more information.

import ctypes

Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python2.6/ctypes/__init__.py, line 10, in module
from _ctypes import Union, Structure, Array
ImportError: No such file or directory

import _ctypes

Traceback (most recent call last):
  File stdin, line 1, in module
ImportError: No such file or directory

import somethingunknown

Traceback (most recent call last):
  File stdin, line 1, in module
ImportError: No module named somethingunknown


As you can see, _ctypes is well known to python, because the error is No such 
file
or directory. Otherwise (see last command) the error message would be No 
module
named _ctypes.

A look in the directory for DLLs gives the following:

$ ls -l /usr/lib/python2.6/lib-dynload/ | grep cty
-rwxr-xr-x 1 dran01 root  91150 2010-06-12 23:11 _ctypes.dll
-rwxr-xr-x 1 dran01 root  14862 2010-06-12 23:11 _ctypes_test.dll

Other DLLs from this directory import correctly, e.g. _ctypes_test :

$ python
Python 2.6.5 (r265:79063, Jun 12 2010, 17:07:01)
[GCC 4.3.4 20090804 (release) 1] on cygwin
Type help, copyright, credits or license for more information.

import _ctypes_test



So the problem is clearly a broken _ctypes.dll

Can I do something specific to track down the problem further?

Kind regards,
Kay Drangmeister

P.S. For the interested: The problem with Eclipse-Plugin pydev is:
No output was in the standard output when trying to create the interpreter info.
The error output contains:

Traceback (most recent call last):

  File 
C:\Java\eclipse35SR1\plugins\org.python.pydev_1.5.7.2010050621\PySrc\interpreterInfo.py,
 line 33, in module
import ctypes
  File /usr/lib/python2.6/ctypes/__init__.py, line 10, in module
from _ctypes import Union, Structure, Array
ImportError: No such file or directory


--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Case resolved (was: Python 2.6 - ctypes (specifically _ctypes) cannot be imported - Eclipse pydev integration broken as a result)

2010-06-23 Thread Kay Drangmeister

Hi,

Am 23.06.2010, 10:48 Uhr, schrieb Yaakov (Cygwin/X) 
yselkow...@users.sourceforge.net:

cygcheck /usr/lib/python2.6/lib-dynload/_ctypes.dll

Sorry, did not know that command,

$ cygcheck /usr/lib/python2.6/lib-dynload/_ctypes.dll
C:\Utilities\cygwin\lib\python2.6\lib-dynload\_ctypes.dll
  C:\Utilities\cygwin\bin\libpython2.6.dll
C:\Utilities\cygwin\bin\cygwin1.dll
  C:\WINDOWS\system32\ADVAPI32.DLL
C:\WINDOWS\system32\KERNEL32.dll
  C:\WINDOWS\system32\ntdll.dll
C:\WINDOWS\system32\RPCRT4.dll
  C:\WINDOWS\system32\Secur32.dll
C:\Utilities\cygwin\bin\cyggcc_s-1.dll
cygcheck: track_down: could not find cygffi-4.dll


install the libffi4 package

DONE

$ python
Python 2.6.5 (r265:79063, Jun 12 2010, 17:07:01)
[GCC 4.3.4 20090804 (release) 1] on cygwin
Type help, copyright, credits or license for more information.

import ctypes



Yay!


(Jason: libffi4 is missing from python's requires


Seems like it. Thank you so much Yaakov. Sorry I browsed over the 
problems.html
webpage, but overlooked the existence of cygcheck.

So thanks again, hereby I confirm not only ctypes works, but the eclipse pydev
plugin works with the cygwin python interpreter very well.

All the best, have a very nice week, greetings from Würzburg
Kay

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple