About Pybluez

Asked 2 years ago, Updated 2 years ago, 78 views

I would like to scan multiple terminals using Raspberry 3 model B, but I get an error.
Python is 2.7.9 and bluez is 5.19, using the code at the following URL:
https://github.com/switchdoclabs/iBeacon-Scanner-/blob/master/testblescan.py
The error statement is:

pi@raspberry:~/iBeacon-Scanner-$sudopython testblescan.py
Traceback (most recent call last):
 File "testblescan.py", line 4.in<module>
  import blescan
 File "/home/pi/iBeacon-Scanner-/blescan.py", line 21, In<module>
  import bluetooth._bluetooth as bluez 
ImportErrot: No module named bluetooth._bluetooth

I checked the error and found out that pybluez was not included, so I did the following, but

pi@raspberry:~$pip install pybluez
Requirement already satified (use -- upgrade to upgrade): pybluez in /usr/lib/python 2.7/dist-packages
Cleaning up...

appears.

It's my first time touching raspberry pi and python, so I don't know how to fix it.
I would appreciate it if you could tell me how to solve it.

Also, I thought the python version was bad, so I configured it in python 3.4.2 and ran it

pi@raspberry:~/iBeacon-Scanner-$sudopython3 testblescan.py
  File "testblescan.py", line 16
   sys.exit(1)
             ^
TabError: inconsistent use of tabs and spaces in indication

The error was displayed.
I have no knowledge of python and I don't know how to fix it.

I would appreciate it if you could let me know which version it is.

python raspberry-pi bluez

2022-09-30 17:06

1 Answers

ImportErrot: No module named bluetooth._bluetooth

There may be several pythons installed and python and pip are different versions.

Check with which python pip.

TabError: inconsistent use of tabs and spaces in indication

Google Translation says "Inconsistent Use of Tabs and Space in Indent."

Python interprets blocks of for and if statements with indentation, making them more strict than other languages.
In Python 3, don't mix tabs and spaces with indentation, but unify them into one or the other.(Space is recommended)

Tabs can be 4 or 8 wide depending on the editor, so you should stop mixing tabs and spaces, not just Python.


2022-09-30 17:06

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.