more G-Labs products

Author Topic: Bluetooth in Phyton - Not Import Module  (Read 975 times)

September 08, 2015, 03:06:26 PM
Read 975 times

fra290

  • *
  • Information
  • Newbie
  • Posts: 15
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


September 08, 2015, 04:28:40 PM
Reply #1

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer