HomeGenie Forum

General Category => Troubleshooting and Support => Topic started by: fra290 on September 08, 2015, 03:06:26 PM

Title: Bluetooth in Phyton - Not Import Module
Post by: fra290 on September 08, 2015, 03:06:26 PM
Hi All.
I have install all Bluetooth software in Rasbian
sudo apt-get bluetooth bluez-utils python-bluetooth

if I use it in a Python on terminal all work fine:

Python 2.7.3 (default, Mar 18 2014, 05:13:23)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import bluetooth
>>> devices = bluetooth.discover_devices()
>>> print (devices)
['2C:D0:5A:88:92:E1']
>>>

but if I use the same code in a new program in HG with a path definition like:
Code: [Select]
import sys
sys.path.append("/usr/lib/python2.7/")
sys.path.append("/usr/lib/python2.7/dist-packages")
sys.path.append("/usr/lib/python2.7/dist-packages/bluetooth")

import bluetooth

devices = bluetooth.discover_devices()


I have this error: global name 'discover_devices' is not defined
I also test to define all path that I have on Python out of HG where the code run but I have the same problem.
Any idea?
   MArco

Title: Re: Bluetooth in Phyton - Not Import Module
Post by: Gene on September 08, 2015, 04:28:40 PM
IronPython won't import compiled C/C++ modules:

https://billthorp.wordpress.com/2007/06/18/python-vs-ironpython-tilecache/

g.