On 9/11/12 17:07:13, R. David Murray wrote: > On Fri, 09 Nov 2012 16:44:00 +0100, Hans Mulder <hansmu at xs4all.nl> wrote: >> I looked into it, and the problem is this bit of code (line 230-235): >> >> try: >> self.assertTrue(os.path.exists(tmp_file)) >> fp = urllib.urlopen(tmp_fileurl) >> finally: >> os.close(fd) >> fp.close() >> >> Due to a misconfiguration, urllib.thishost() raises an IOError on my >> laptop. This causes urllib.urlopen to raise an exception, and the >> name fp is never bound, so that the fp.close() in the finally clause >> raises an UnboundLocalError, masking the problem in urlopen. >> >> A quick fix would be: >> >> try: >> self.assertTrue(os.path.exists(tmp_file)) >> fp = urllib.urlopen(tmp_fileurl) >> fp.close() >> finally: >> os.close(fd) >> >> That way, the .close is only attempted if the open succeeds. > > Could you open an issue for this on the tracker, please? That > way we won't forget to fix it. Done: issue 16450. -- HansM
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4