Ticket #26186 (new defect)
python25: No module named _ctypes
| Reported by: | joe.paxton@… | Owned by: | jwa@… |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | ports | Version: | 1.9.1 |
| Keywords: | Cc: | jameskyle@…, ryandesign@…, luca@… | |
| Port: | python25 |
Description
Mac OS X 10.6.4 Xcode 3.2.2
When attempting to get a list of installed modules (help('modules')) in python25, I'm getting the following error message: NameError: name 'ctypes' is not defined
The problem does not appear to be an upstream issue, as the version of python 2.5 that comes pre-installed in Snow Leopard doesn't
The full traceback follows:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site.py", line 346, in __call__
return pydoc.help(*args, **kwds)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/pydoc.py", line 1646, in __call__
self.help(request)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/pydoc.py", line 1683, in help
elif request == 'modules': self.listmodules()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/pydoc.py", line 1804, in listmodules
ModuleScanner().run(callback)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/pydoc.py", line 1855, in run
for importer, modname, ispkg in pkgutil.walk_packages():
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/pkgutil.py", line 125, in walk_packages
for item in walk_packages(path, name+'.', onerror):
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/pkgutil.py", line 110, in walk_packages
__import__(name)
File "/opt/local/lib/python2.5/site-packages/PsychoPy-1.62.00-py2.5.egg/psychopy/ext/__init__.py", line 18, in <module>
from darwin import *
File "/opt/local/lib/python2.5/site-packages/PsychoPy-1.62.00-py2.5.egg/psychopy/ext/darwin.py", line 16, in <module>
kCGLCPSwapInterval= ctypes.c_int(222)
NameError: name 'ctypes' is not defined
Change History
comment:2 Changed 3 years ago by joe.paxton@…
And please let me know if this is better categorized as a bug with PsychoPy, and I'll submit a ticket to that package's maintainer.
comment:3 Changed 3 years ago by jmr@…
- Keywords python25, ctypes removed
- Cc jwa@…, jameskyle@… added; joe.paxton@… removed
- Port changed from python25 @2.5.5 to python25 py25-psychopy
- Summary changed from python25-2.5.5 NameError: name 'ctypes' is not defined to python25 @2.5.5 + PsychoPy: NameError: name 'ctypes' is not defined
Please remember to cc the maintainer, and note that you do not need to be in cc when you are the reporter.
comment:4 Changed 3 years ago by joe.paxton@…
The traceback I originally submitted was for the wrong version of psychopy. Here is the correct traceback:
Traceback (most recent call last):
File "./simpleExp.py", line 4, in <module>
from psychopy import visual, core, event
File "/opt/local/lib/python2.5/site-packages/psychopy/visual.py", line 8, in <module>
from psychopy import core, ext, log, preferences, monitors
File "/opt/local/lib/python2.5/site-packages/psychopy/core.py", line 8, in <module>
from ext import rush
File "/opt/local/lib/python2.5/site-packages/psychopy/ext/__init__.py", line 11, in <module>
from darwin import *
File "/opt/local/lib/python2.5/site-packages/psychopy/ext/darwin.py", line 5, in <module>
import sys, ctypes, ctypes.util, time
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ctypes/__init__.py", line 10, in <module>
from _ctypes import Union, Structure, Array
ImportError: No module named _ctypes
However, given that I'm getting the same error with both versions of psychopy (both the Macports version and the most recent version installed thru easy_install), perhaps this is actually an upstream problem? If so, feel free to close this ticket, and I'll submit the bug to the psychopy devs.
comment:5 Changed 2 years ago by ryandesign@…
- Cc ryandesign@… added; jwa@… removed
- Owner changed from macports-tickets@… to jwa@…
- Port changed from python25 py25-psychopy to python25
- Summary changed from python25 @2.5.5 + PsychoPy: NameError: name 'ctypes' is not defined to python25: No module named _ctypes
Indeed, python25 does not install the ctypes module, though it should, and though other ports rightly expect it to. python25 installs without error, but if you look in the verbose build output, it says:
*** WARNING: renaming "_ctypes" since importing it failed: dlopen(build/lib.macosx-10.6-i386-2.5/_ctypes.so, 2): Symbol not found: _ffi_call Referenced from: /opt/local/var/macports/build/_Users_rschmidt_macports_dports_lang_python25/work/Python-2.5.5/build/lib.macosx-10.6-i386-2.5/_ctypes.so Expected in: flat namespace in /opt/local/var/macports/build/_Users_rschmidt_macports_dports_lang_python25/work/Python-2.5.5/build/lib.macosx-10.6-i386-2.5/_ctypes.so
comment:7 Changed 22 months ago by jmr@…
It appears that the bundled libffi, like many other things in python < 2.6, doesn't work right on 64-bit OS X. Fixing this would likely require considerable effort and involve a lot of the changes that went into python 2.6. Unless a patch turns up, I think the maintainer should feel free to resolve this as wontfix.


Sorry for the double submission. Please ignore the first one (#26185).