Skip to content. | Skip to navigation

Personal tools


You are here: Home / Members / jhb / pys60 / Selecting access point only once

Selecting access point only once

by Jörg Baach last modified May 13, 2009 12:51 AM
When using urllib the 'select access point dialog points up all too frequent. But its possible to fix that

With browsing the python s60 forum I was got the impression that

sys.modules['socket'] = __import__('btsocket')

would override the socket module with the btsocket, but it didn't. The 'usual'

apid = socket.select_access_point()
apo = socket.access_point(apid)

did not show any effects when doing urllib.urlopen calls after that - the dialog opens every single time.

The solution seems to be using socket for ip connections, and btsocket for bluetooth stuff.

import socket
import appuifw

aps = [ap['name'] for ap in socket.access_points()]
apid = appuifw.popup_menu(aps,u'select access point')

import urllib
print 'baach'
print 'google'
print 'fini'

The trick is that socket.set_default_access_point takes unicode access point names, in contrast to the btsocket.set_default_access_point, which wants to have an access point object.


Add comment

You can add a comment by filling out the form below. Plain text formatting.

Question: What is 42 minus 19?
Your answer: