Skip to content

Commit

Permalink
fix the bug ctypes.util.find_library to search for librados failed o…
Browse files Browse the repository at this point in the history
…n Centos6.4.

  Signed-off-by: huangjun  <[email protected]>
  • Loading branch information
hjwsm1989 committed Oct 29, 2013
1 parent 702234d commit e46d2ca
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/pybind/rados.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,15 @@ def __init__(self, rados_id=None, name=None, clustername=None,
conf_defaults=None, conffile=None, conf=None, flags=0):
librados_path = find_library('rados')
if not librados_path:
raise EnvironmentError("Unable to find librados")
self.librados = CDLL(librados_path)
#maybe find_library can not find it correctly on all platforms.
try:
self.librados = CDLL('librados.so.2')
except OSError:
raise EnvironmentError("Unable to find librados")
except:
raise Error("Unexpected error")
else:
self.librados = CDLL(librados_path)
self.cluster = c_void_p()
self.rados_id = rados_id
if rados_id is not None and not isinstance(rados_id, str):
Expand Down

0 comments on commit e46d2ca

Please sign in to comment.