Hello all,

I am trying to find out the reason for some weird behavior on Windows.

We have the following code:

import urllib2

req = urllib2.Request("https://benotificationsmock.cloudapp.net:8443";)
resp = urllib2.urlopen(req, timeout = 5)
print resp.code

This simple script should print "200". However, all I ever get when running 
this on any Windows machine (for reference, mine is Windows 7, Python 2.7.3 and 
OpenSSL 1.0.0c / 0.9.8x) is the following exception:

Traceback (most recent call last):
  File "foo.py", line 5, in <module>
    resp = urllib2.urlopen(req, timeout = 5)
  File "C:\Python27\lib\urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "C:\Python27\lib\urllib2.py", line 400, in open
    response = self._open(req, data)
  File "C:\Python27\lib\urllib2.py", line 418, in _open
    '_open', req)
  File "C:\Python27\lib\urllib2.py", line 378, in _call_chain
    result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 1215, in https_open
    return self.do_open(httplib.HTTPSConnection, req)
  File "C:\Python27\lib\urllib2.py", line 1177, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error timed out>

Firewalls are not at fault here, as netstat reports that the connection is 
being established. The only problem is that reading from the socket seems to 
fail.
The exact same code runs fine on Linux. The only way to make it work on Windows 
is to remove the non-standard port.

Did anyone else encounter this weird behavior? Can anyone give any suggestions? 
Any feedback would be greatly appreciated.

Best regards,
Claudiu

--
Claudiu CURCĂ

Software Development Engineer in Test II / Backend Core Prague / Microsoft 
Skype Division
Telephone: +40 741 289 849
Skype: claudiu_curca

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to