[Tutor] AF_BLUETOOTH with windows?

Alan Gauld alan.gauld at yahoo.co.uk
Tue Jul 12 16:45:26 EDT 2016

On 12/07/16 15:32, ammar jallawi wrote:

> # Simple TCP client and server that send and receive 16 octets
> import socket, sys
> s = socket.socket(socket.AF_BLUETOOTH, socket.SO_REUSEADDR, socket.BTPROTO_RFCOMM)

> and getting this error:
> AttributeError: 'module' object has no attribute 'AF_BLUETOOTH'
> Is the AF_BLUETOOTH supported in windows? if not what I need to do? thanks

Please always include the full error text not just the last line summary.

In this case it was fairly easy to find the error source but if it had
been further down or had multiple references it would have been harder.

As to the error what makes you think AF_BLUETOOTH is a valid protocol?
There is no mention of it in the module documentation for Python v2.7
(which is what you appear to be targeting).

It does appear from v3.3 so you need to target that version
(or later) of Python.

Alan G
Author of the Learn to Program web site
Follow my photo-blog on Flickr at:

More information about the Tutor mailing list