[New-bugs-announce] [issue18502] CDLL does not use same paths as util.find_library

Steven Johnson report at bugs.python.org
Fri Jul 19 00:11:22 CEST 2013


New submission from Steven Johnson:

CDLL does not use the same paths as find_library and thus you can *find* a library, but you can't necessarily use it.

In my case, I had SDL2 in /usr/local/lib. find_library correctly gets
the name, but does not return the path. CDLL apparently does not search
/usr/local/lib and fails.

Python 3.4.0a0 (default:5a6cdc0d7de1, Jul 18 2013, 17:55:27) 
[GCC 4.7.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from ctypes import *
>>> import ctypes.util
>>> ctypes.util.find_library("SDL2")
'libSDL2-2.0.so.0'
>>> CDLL(_)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/steven/Programming/cpython/Lib/ctypes/__init__.py", line 351, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libSDL2-2.0.so.0: cannot open shared object file: No such file or directory
>>> CDLL("/usr/local/lib/libSDL2.so")
<CDLL '/usr/local/lib/libSDL2.so', handle 22f89c0 at 7fc966da5ae8>

----------
components: ctypes
messages: 193332
nosy: shjohnson.pi
priority: normal
severity: normal
status: open
title: CDLL does not use same paths as util.find_library
type: behavior
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18502>
_______________________________________


More information about the New-bugs-announce mailing list