← index #760Issue #6380
Related · high · value 1.648
QUERY · ISSUE

aioble: AttributeError: 'module' object has no attribute 'Service' (and - no instructions, and lack of useful examples)

openby gitcndopened 2023-10-29updated 2025-05-25
needs-info

It is not clear from this page:-

https://github.com/micropython/micropython-lib/tree/master/micropython/bluetooth/aioble#passive-scan-for-nearby-devices-for-5-seconds-observer

how to use any of that code

>>> import l2cap_file_server
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "l2cap_file_server.py", line 53, in <module>
AttributeError: 'module' object has no attribute 'Service'
>>> 

we need to be told what to do to make it work, and there needs to be working examples to show the features - especially the "scan" - and the examples need to tell you what you need to to do run them.

even the multitests don't seem to work? (and there's no tests for the scan feature):

MicroPython v1.21.0 on 2023-10-06; Generic ESP32 module with OTA with ESP32

Type "help()" for more information.

>>> import notify
>>> notify.instance1()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "notify.py", line 148, in instance1
AttributeError: 'module' object has no attribute 'stop'
>>> 

disclaimer: I'm not an expert in MicroPython

3 comments
fpetzold · 2024-07-09

I had the problem when I try to use aioble compiled in as a module in MicroPython. When I install aioble with mpi on the board itself, everything works.

jonnor · 2024-10-12

@gitcnd Does installing the module with mip solve the problem, as suggested by @fpetzold ?

GPwebdesign · 2025-05-25

Installing the module with mip solve the problem also for me.
thank's @fpetzold

CANDIDATE · ISSUE

`bluetooth.FLAG_INDICATE` not assigned.

closedby cyber-murmelopened 2020-08-27updated 2020-08-28
extmod

I tried to run the examples/bluetooth/ble_temperature.py and it failed with

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "ble_temperature.py", line 23, in <module>
AttributeError: 'module' object has no attribute 'FLAG_INDICATE'

FLAG_INDICATE is not defined

>> bluetooth.
__class__       __name__        BLE             FLAG_NOTIFY
FLAG_READ       FLAG_WRITE      UUID
>>> bluetooth.FLAG_NOTIFY
16
>>> bluetooth.FLAG_READ
2
>>> bluetooth.FLAG_WRITE
8

According to the ESP-IDF[https://github.com/espressif/esp-idf/blob/dd8db6621b930a9cbfeef14a0d4daba8c8506e74/components/bt/host/bluedroid/api/include/api/esp_gatt_defs.h#L295] it needs to be 0x20

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied