I seemed to have figured out the problem, but still have no clue why the error is occurring.
The problem is with a GPRS connection that I have opened a little prior to my call of location.gsm_location.
The code is -
Somehow, despite giving the conn.close() command, the GPRS connection still seems to be active. I can see the small gprs icon on the top left of the screen. Whenever GPRS is working, the location module does not work.
conn = httplib.HTTPConnection("www.python.org")
r = conn.getresponse()
d = r.read()
X, Y = d.split("</head>\n")
date, Z = Y.split("\n<body>")
str_out = str_out + date+"\n\n"
a, b, c, d = location.gsm_location()
I guess the whole problem boils down to closing the gprs connection. Any idea how that is done? This conn.close() does not seem to be doing the trick. In fact, the only way I can get rid of the "gprs active" icon (top-left) is if I shut down the application and re-open it.