Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #37501
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <nick.cash@npcinternational.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'socket': 0.05; 'urllib2': 0.07; 'python': 0.09; 'differently.': 0.09; 'expected.': 0.09; 'garbage': 0.09; 'received:216.32.180': 0.09; '(may': 0.16; '2.7.3': 0.16; 'bug,': 0.16; 'reproduce': 0.16; 'spurious': 0.16; 'url:ftp': 0.16; 'urllib': 0.16; 'urllib2,': 0.16; 'equivalent': 0.20; 'to:name:python-list@python.org': 0.20; 'fairly': 0.21; "i've": 0.23; 'seems': 0.23; 'received:169.254': 0.24; 'linux': 0.24; 'looks': 0.26; 'guess': 0.27; 'object,': 0.27; 'received:216.32': 0.27; "doesn't": 0.28; 'fine': 0.28; 'noticed': 0.28; 'though.': 0.29; 'received:169': 0.29; "i'm": 0.29; 'error': 0.30; 'header:Received:8': 0.30; 'code': 0.31; 'could': 0.32; 'getting': 0.33; 'to:addr:python-list': 0.33; 'loss': 0.34; 'received:bigfish.com': 0.35; 'something': 0.35; 'except': 0.36; 'skip:u 20': 0.36; 'but': 0.36; 'charset:us-ascii': 0.36; 'received:10': 0.38; 'to:addr:python.org': 0.39; 'skip:u 10': 0.60; 'first': 0.61; 'received:216': 0.62; 'hang': 0.65; '"".': 0.84; 'url:path': 0.84; 'results,': 0.91; 'url:site': 0.91 |
| X-Forefront-Antispam-Report | CIP:157.56.240.117; KIP:(null); UIP:(null); IPV:NLI; H:BL2PRD0610HT003.namprd06.prod.outlook.com; RD:none; EFVD:NLI |
| X-SpamScore | 0 |
| X-BigFish | PS0(zzzz1ee6h1de0h1202h1e76h1d1ah1d2ahzzz2fh2a8h668h839h944hd25hf0ah1220h1288h12a5h12a9h12bdh137ah13b6h1441h1504h1537h153bh15d0h162dh1631h1758h18e1h1155h) |
| Received-SPF | pass (mail87-co1: domain of npcinternational.com designates 157.56.240.117 as permitted sender) client-ip=157.56.240.117; envelope-from=nick.cash@npcinternational.com; helo=BL2PRD0610HT003.namprd06.prod.outlook.com ; .outlook.com ; |
| From | Nick Cash <nick.cash@npcinternational.com> |
| To | "python-list@python.org" <python-list@python.org> |
| Subject | urllib2 FTP Weirdness |
| Thread-Topic | urllib2 FTP Weirdness |
| Thread-Index | Ac35pVT2IXI8qA7cR56nSJ0bJ/GFnA== |
| Date | Wed, 23 Jan 2013 20:07:56 +0000 |
| Accept-Language | en-US |
| Content-Language | en-US |
| X-MS-Has-Attach | |
| X-MS-TNEF-Correlator | |
| x-originating-ip | [70.166.238.194] |
| Content-Type | text/plain; charset="us-ascii" |
| Content-Transfer-Encoding | quoted-printable |
| MIME-Version | 1.0 |
| X-OriginatorOrg | npcinternational.com |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.919.1358971685.2939.python-list@python.org> (permalink) |
| Lines | 26 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1358971685 news.xs4all.nl 6847 [2001:888:2000:d::a6]:33315 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:37501 |
Show key headers only | View raw
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/".
I've tested the equivalent code on Python 3.2.3 and get the same results, except that one time I got a socket error (may have been a spurious network blip, though).
I'm at a loss as to how that could even work differently. My only guess is that by not having a reference to the addinfourl response object, something important is getting garbage collected or closed... that seems like a stretch, though. Is this a urllib2 bug, or am I crazy?
-Nick Cash
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
urllib2 FTP Weirdness Nick Cash <nick.cash@npcinternational.com> - 2013-01-23 20:07 +0000 Re: urllib2 FTP Weirdness Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-24 11:41 +1100
csiph-web