._GLOBAL_DEFAULT_TIMEOUT occurs on simple urlopen

Viewed 6119

I've got a problem which is this:

Sorry
Traceback (most recent call last):
File "testconn.py", line 2, in <module>
import httplib
File "C:\Python27\lib\httplib.py", line 680, in <module>
class HTTPConnection:
File "C:\Python27\lib\httplib.py", line 692, in HTTPConnection
timeout=socket._GLOBAL_DEFAULT_TIMEOUT, source_address=None):
AttributeError: 'module' object has no attribute '_GLOBAL_DEFAULT_TIMEOUT'   

I seriously didn't have this issue like 3 days ago, everything was working fine and now this. Here's my code: (To mention that I tried adding timeout, I tried following the strict syntax of urlopen (Adding timeout aswell). Nothing seemed to do it.)

import httplib
import urllib2

headers = {"pragma" : "no-cache"}
req = urllib2.Request("http://google.com/", headers = header)
response=urllib2.urlopen(req)

print response

I'd appreciate any help.

2 Answers
Related