Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.nosignal.org!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.019 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'python': 0.09; 'expected.': 0.09; 'windows,': 0.09; '2.7.3': 0.16; '24,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'nick': 0.16; 'reproduce': 0.16; 'url:ftp': 0.16; 'urllib': 0.16; 'urllib2,': 0.16; 'weird.': 0.16; 'wrote:': 0.17; 'thu,': 0.17; 'jan': 0.18; 'fairly': 0.21; 'linux': 0.24; 'header:In-Reply- To:1': 0.25; 'looks': 0.26; 'am,': 0.27; 'possibly': 0.27; 'message-id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'fine': 0.28; 'noticed': 0.28; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'confirmed': 0.35; 'received:209.85': 0.35; 'skip:u 20': 0.36; 'but': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'skip:u 10': 0.60; 'first': 0.61; 'kind': 0.61; 'hang': 0.65; 'race': 0.71; '"".': 0.84; '2013': 0.84; 'url:path': 0.84; 'url:site': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=x7cQHfaZw0U7087rE1tqVZewY2GIRN1ps8K+F+RV294=; b=O2US42Yplq4im4DG2sKFg1BN/3DHAflRS9Bdo/tCl/kIKNaZG6koy7lqxQWjxo4jqQ NFoWORqWWGZKyBs5QZlI9mhne8ocYX96GYq+p1FyI/hPKpcfeuy3gvqz2907KvPIFOa1 iskX3XHXor0hvdX5uupVW4LsG/R3+eTGe1Z076v+9rpXIVCOIeMoifX5OUpLD1YZn6X+ orr3TsuBQtVc8YapUXh7cNujVjSi4l15DePjGX8vYugBED9pKHFUHFngocidYPHSZdQG LE6ROsmhEF51jkRNIv7Wb/99lOZUtWFTf1aV3sHdxlPiEXnUYStWixHcuIF9b//jW9eT rXtg== MIME-Version: 1.0 X-Received: by 10.221.11.205 with SMTP id pf13mr3425809vcb.70.1358985484747; Wed, 23 Jan 2013 15:58:04 -0800 (PST) In-Reply-To: <846C3A8E860C4344B567D813B63AA51D6F905ED8@BL2PRD0610MB349.namprd06.prod.outlook.com> References: <846C3A8E860C4344B567D813B63AA51D6F905ED8@BL2PRD0610MB349.namprd06.prod.outlook.com> Date: Thu, 24 Jan 2013 10:58:04 +1100 Subject: Re: urllib2 FTP Weirdness From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1358985494 news.xs4all.nl 6848 [2001:888:2000:d::a6]:58635 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:37521 On Thu, Jan 24, 2013 at 7:07 AM, Nick Cash wrote: > Python 2.7.3 on linux > > This has me fairly stumped. It looks like > urllib2.urlopen("ftp://some.ftp.site/path").read() > will either immediately return '' or hang indefinitely. But > response = urllib2.urlopen("ftp://some.ftp.site/path") > response.read() > works fine and returns what is expected. This is only an issue with urllib2, vanilla urllib doesn't do it. > > The site I first noticed it on is private, but I can reproduce it with "ftp://ftp2.census.gov/". Confirmed on 2.6.5 on Windows, fwiw. This is extremely weird. Possibly it's some kind of race condition?? ChrisA