[linux-minidisc] PythonNetMD and MacOS X
Hi,
today I received an email from a user who had trouble using the NetMD
Python scripts on MacOS X. He received the following error message:
$ ./upload.py
Traceback (most recent call last):
File "./upload.py", line 3, in <module>
import usb1
File "/Users/henningautzen/linux-minidisc/netmd/usb1.py", line 2, in
<module>
import libusb1
File "/Users/henningautzen/linux-minidisc/netmd/libusb1.py", line
54, in <module>
libusb = cdll.LoadLibrary('libusb-1.0.so.0')
File
"/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ctypes/__init__.py",
line 423, in LoadLibrary
return self._dlltype(name)
File
"/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ctypes/__init__.py",
line 345, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(libusb-1.0.so.0, 6): image not found
$
The problem is obvious, the script cannot find the shared libusb
library even though it has been installed. The library is located in a
different location when installed with Macports, namely:
/opt/local/lib/libusb-1.0.dylib
I created a temporary patch for the user to fix his problem (patch
attached). We need, however, a proper patch to fix that.
Adrian
--- libusb1.py 2010-02-11 23:12:27.000000000 +0100
+++ libusb1.py.new 2010-02-16 00:19:11.000000000 +0100
@@ -51,7 +51,7 @@
('tv_usec', c_long)]
timeval_p = POINTER(timeval)
-libusb = cdll.LoadLibrary('libusb-1.0.so.0')
+libusb = cdll.LoadLibrary('/opt/local/lib/libusb-1.0.dylib')
# libusb.h
def bswap16(x):