Search code examples
pythonwinapidllbluetoothpybluez

After installing PyBluez on Windows8.1 I get DLL %1 not valid win32 app


I have installed PyBluez-0.22.win32.exe on a 64bit machine with Python 2.7 (they didn't have a 64bit version). Then I get the following error: ImportError:DLL load failed:%1 is not valid Win32 application.

Any idea how I could fix this? enter image description here

Here is the part of code that depends on bluetooth:

from bluetooth import *
import bluetooth._msbt as bt

bt.initwinsock ()

Solution

  • That error message occurs when you try to use a 64-bit Python interpreter and a 32-bit extension module. The same error message can occur if you are using a 32-bit Python interpreter and a 64-bit extension module.

    If PyBluez is only available as a 32-bit library, then you'll need to install a 32-bit version of Python.

    It looks like unofficial 64-bit versions are available from http://www.lfd.uci.edu/~gohlke/pythonlibs/