mqtt-users team mailing list archive
-
mqtt-users team
-
Mailing list archive
-
Message #00042
python mosquitto 0.10 on windows.
Hi,
I'm trying to use mosquitto 0.10 with python 2.7 on windows. I can use the mosquitto_sub.exe commands quite happily,
and see the data, but there seems to be a ctypes problem finding the mosquitto.dll when I try and use the python
bindings. (Full stack trace below)
It seems that ctypes.util.find_library("mosquitto") is failing. I found a related post in the comments at
http://mosquitto.org/2010/11/version-0-9-released/ and the reply was that mosquitto.dll needed to be put somewhere on
the path.
I've tried putting the dll in just about everywhere in sys.path, to no avail. I've put it in C:\tools\Python27\Lib\site-packages
which is where the mosquitto.py ended up, following Roger's comments... "I know it works if you put in
C:\Python27\lib\site-packages\ (assuming Python 2.7 and thats where mosquitto.py ended up) but Im not really sure what
the proper way to deal with this is."
but that still doesn't work for me. Any ideas?
C:\srcx\python\mqtt_debug\src>python
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import mosquitto
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\tools\python27\lib\site-packages\mosquitto.py", line 408, in <module>
_libmosq = cdll.LoadLibrary(find_library("mosquitto"))
File "c:\tools\python27\lib\ctypes\__init__.py", line 431, in LoadLibrary
return self._dlltype(name)
File "c:\tools\python27\lib\ctypes\__init__.py", line 353, in __init__
self._handle = _dlopen(self._name, mode)
TypeError: expected string or Unicode object, NoneType found
>>> import ctypes.util
>>> ctypes.util.find_library("mosquitto")
>>> print ctypes.util.find_library("mosquitto")
None
>>> print ctypes.util.find_library("mosquitto.dll")
None
>>> import sys
>>> print sys.path
['', 'C:\\windows\\system32\\python27.zip', 'c:\\tools\\python27\\DLLs', 'c:\\to
ols\\python27\\lib', 'c:\\tools\\python27\\lib\\plat-win', 'c:\\tools\\python27\
\lib\\lib-tk', 'c:\\tools\\python27', 'c:\\tools\\python27\\lib\\site-packages']
I've tried DLLs, the root directory, the current source directory, lib\site-packages, lib and libs, but no luck yet.
Sincerely,
Karl P
Follow ups