A problem while using urllib
Wed Oct 12 09:15:00 GMT 2005
On Oct 12 09:57, Steve Holden wrote:
> I realized after this post that WingIDE doesn't run under Cygwin, so I
> modified the code further to raise an error and give us a proper
> traceback. I also tested the program under the standard Windows 2.4.1
> release, where it didn't fail, so I conclude you have unearthed a Cygwin
> socket bug. Here's the traceback:
> End process http://www.holdenweb.com/contact.html
> Start process http://freshmeat.net/releases/192449
> Error: IOError while parsing http://freshmeat.net/releases/192449
> Message: <urlopen error (120, 'Operation already in progress')>
> Traceback (most recent call last):
> File "Spider_bug.py", line 225, in ?
> File "Spider_bug.py", line 143, in run
> File "Spider_bug.py", line 166, in grabUrl
> webPage = urllib2.urlopen(url).read()
> File "/usr/lib/python2.4/urllib2.py", line 130, in urlopen
> return _opener.open(url, data)
> File "/usr/lib/python2.4/urllib2.py", line 358, in open
> response = self._open(req, data)
> File "/usr/lib/python2.4/urllib2.py", line 376, in _open
> '_open', req)
> File "/usr/lib/python2.4/urllib2.py", line 337, in _call_chain
> result = func(*args)
> File "/usr/lib/python2.4/urllib2.py", line 1021, in http_open
> return self.do_open(httplib.HTTPConnection, req)
> File "/usr/lib/python2.4/urllib2.py", line 996, in do_open
> raise URLError(err)
> urllib2.URLError: <urlopen error (120, 'Operation already in progress')>
> Looking at that part of the course of urrllib2 we see:
> headers["Connection"] = "close"
> h.request(req.get_method(), req.get_selector(), req.data,
> r = h.getresponse()
> except socket.error, err: # XXX what error?
> raise URLError(err)
> So my conclusion is that there's something in the Cygwin socket module
> that causes problems not seen under other platforms.
> I couldn't find any obviously-related error in the Python bug tracker,
> and I have copied this message to the Cygwin list in case someone there
> knows what the problem is.
> Before making any kind of bug submission you should really see if you
> can build a program shorter that the existing 220+ lines to demonstrate
> the bug, but it does look to me like your program should work (as indeed
> it does on other platforms).
Talking about a testcase, if you want to submit a bug report, could
you please apply a simple, self-contained, OOTB testcase, written in
plain C, which shows what's going on? I just see an EINPROGRESS error
message above and I don't speak Python. If this is something Cygwin
induced, then I see only two potential problems, both in connect().
Either a connect is called twice on a blocking socket, or a connection
fails and the error code is wrong for some reason. A simple testcase
would help enormously.
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat, Inc.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
More information about the Cygwin