question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

module 'socket' has no attribute 'AF_BLUETOOTH'

See original GitHub issue

This is the output which gets triggered as soon as I try to pair the device:

[info][controller 1] Created devices /dev/input/js0 (joystick) /dev/input/event21 (evdev) 
[info][bluetooth] Scanning for devices
[info][bluetooth] Found device A4:53:85:38:DB:02
Traceback (most recent call last):
  File "/usr/bin/ds4drv", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python3.6/site-packages/ds4drv/__main__.py", line 154, in main
    for device in backend.devices:
  File "/usr/lib/python3.6/site-packages/ds4drv/backends/bluetooth.py", line 132, in devices
    device = self.find_device()
  File "/usr/lib/python3.6/site-packages/ds4drv/backends/bluetooth.py", line 121, in find_device
    return BluetoothDS4Device.connect(bdaddr)
  File "/usr/lib/python3.6/site-packages/ds4drv/backends/bluetooth.py", line 23, in connect
    ctl_socket = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_SEQPACKET,
AttributeError: module 'socket' has no attribute 'AF_BLUETOOTH'

Any idea on how to fix this? Thanks in advance. Btw, using openSUSE Tumbleweed.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
cslevcommented, Sep 15, 2020

Your problem is that the python version you are using does have proper Bluetooth support! I had the same problem when installed python from source and did not have libbluetooth-dev package installed on my system! So, install libbluetooth-dev (or something similar in other than Debian), and reinstall python. The easiest way to check it is working is to fireup a python console from terminal and try this:

from socket import AF_BLUETOOTH
1reaction
LuxMirandacommented, Mar 30, 2019

I’m having the same problem on Ubuntu 18.04

Read more comments on GitHub >

github_iconTop Results From Across the Web

module 'socket' has no attribute 'AF_BLUETOOTH' · Issue #58 ...
I've just installed and it runs normally, unless I select ATC mode ( pi@raspi:~/MiTemperature2 $ python3.9 .
Read more >
How to enable python bluetooth sockets? - Toradex Community
Because of that the bluetooth socket feature is not compiled into ... AttributeError: module 'socket' has no attribute 'AF_BLUETOOTH'.
Read more >
In python3 module 'socket' has no attribute 'AF_BLUETOOTH'
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used...
Read more >
module 'socket' has no attribute 'AF_BLUETOOTH' on Andriod ...
I use kivy, kivymd for developing an app on android (using python). I need to have an access to Bluetooth. The code below...
Read more >
Passive BLE Monitor integration - Home Assistant Community
Please check the FAQ on github. This error (AttributeError: module 'socket' has no attribute 'AF_BLUETOOTH' ) is explained in the faq and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found