[issue18502] CDLL does not use same paths as util.find_library

2013-07-18 Thread Steven Johnson

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 "", line 1, in 
  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")


--
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 
<http://bugs.python.org/issue18502>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18502] CDLL does not use same paths as util.find_library

2013-07-22 Thread Steven Johnson

Steven Johnson added the comment:

Should the docs then be changed for find_library to inform that "It is not 
guaranteed that a found library can be opened" (at least for linux)?

Or would a feature request for full paths from find_library for linux be more 
appropriate?

It seems hackish to me, if a program can find a library, but can't use it 
without asking the user to change some environment variables or testing 
/usr/local/lib.

--

___
Python tracker 
<http://bugs.python.org/issue18502>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com