This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: urllib2.urlopen().read().splitlines() opening a directory in a FTP server randomly returns incorrect results
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: urllib2.urlopen().read().splitlines() opening a directory in a FTP server randomly returns incorrect result
View: 22376
Assigned To: Nosy List: alanoe, orsenthil, r.david.murray
Priority: normal Keywords:

Created on 2014-09-09 21:50 by alanoe, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg226662 - (view) Author: Alan Evangelista (alanoe) Date: 2014-09-09 21:50
Examples in Python command line:

Try 1
-----

>>> import urllib2
urllib2.urlopen('ftp://<user>:<password>@<server>/packages/repodata').read().splitlines()

Output:
<list of files>

Try 2
-----

>>> import urllib2
urllib2.urlopen('ftp://<user>:<password>@<server>/packages/repodata').read().splitlines()

Output:
[]


If I split urllib2.urlopen().read().splitlines() statement in 2 statements (urllib2.urlopen() and read().splitlines()), I always get correct results.

import urllib2
a = urllib2.urlopen('ftp://alan_infinite:pass4root@9.8.234.55/packages/repodata')
>>> a.read().splitlines()

Output:
<file_list>


Verified in Python 2.6.6 in RHEL 6.4, Python 2.7.x in RHEL 7 and Python 2.7.3 in Ubuntu 14.04
msg226665 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-09-09 22:04
I think this was already fixed in issue 15002.
History
Date User Action Args
2022-04-11 14:58:07adminsetgithub: 66569
2014-09-12 22:13:24terry.reedysetsuperseder: urllib2.urlopen().read().splitlines() opening a directory in a FTP server randomly returns incorrect result
resolution: duplicate
stage: resolved
2014-09-09 22:04:01r.david.murraysetnosy: + r.david.murray, orsenthil
messages: + msg226665
2014-09-09 21:52:34alanoesetstatus: open -> closed
2014-09-09 21:50:05alanoecreate