Re: ctypes can't find files in /usr/local/lib?

Larry Bugbee <[email protected]>
Newsgroups gmane.comp.python.ctypes
Message-ID <[email protected]>
> However, when I try to load them in ctypes, I get:
> 
>>>> ctypes.cdll.LoadLibrary ("libownet.so")
> Traceback (most recent call last):
> File "<input>", line 1, in <module>
> File "/usr/lib/python2.6/ctypes/__init__.py", line 431, in LoadLibrary
>   return self._dlltype(name)
> File "/usr/lib/python2.6/ctypes/__init__.py", line 353, in __init__
>   self._handle = _dlopen(self._name, mode)
> OSError: libownet.so: cannot open shared object file: No such file or
> directory

Depending on the OS, they may/will have different search paths for loading of libraries.  From a page I posted a while ago...

   A few general comments about ctypes
   -----------------------------------
     ctypes will look in various locations for shared libraries 
     but where can vary by platform.  Libraries in /usr/lib are 
     pretty much guaranteed to be found, but that may not be the 
     best place for your compiled libraries.  Personally I prefer
     /usr/local/lib.  Regardless of where, you may need to set 
     and export a load library path appropriate to your platform.
       LD_LIBRARY_PATH     Linux
       DYLD_LIBRARY_PATH   Darwin
       SHLIB_PATH          HP-UX
       LD_LIBRARY_PATH_32  32-bit Solaris
       LD_LIBRARY_PATH_64  64-bit Solaris

I hope this helps...  Larry

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev

_______________________________________________
ctypes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ctypes-users
smime.p7s (application/pkcs7-signature, 1.2 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.