classification
Title: urllib2.urlopen().read().splitlines() opening a directory in a FTP server randomly returns incorrect result
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: alanoe, iritkatriel, terry.reedy
Priority: normal Keywords:

Created on 2014-09-09 21:53 by alanoe, last changed 2020-12-01 10:41 by iritkatriel. This issue is now closed.

Messages (4)
msg226664 - (view) Author: Alan Evangelista (alanoe) Date: 2014-09-09 21:53
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://<user>:<password>@<server>/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
msg226689 - (view) Author: Alan Evangelista (alanoe) Date: 2014-09-10 12:00
duplicate of #22375. I closed that one because I wanted to edit the original bug description and I could not, preferred to create a new bug.

R. David Murray's comment in #22375: "I think this was already fixed in issue 15002"
msg226848 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-09-12 22:38
You should have just added a new message to #22375 with the revision.

#15002 ends with "This is fixed in 3.4 and 3.5. I will backport to 2.7 ( I think, it is worth it)." Please check whether the backport has been done or whether current you still have a problem with the latest 2.7.8.  If so, did the 3.4 patch, included in 3.4.1, fix the issue (ie, install 3.4.1 and test).  If you code works on 3.4.1 and not on 2.7.8, you could add a request for a backport to #15002.
msg382230 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2020-12-01 10:41
2.7 backport is no longer possible.
History
Date User Action Args
2020-12-01 10:41:25iritkatrielsetstatus: open -> closed

nosy: + iritkatriel
messages: + msg382230

resolution: out of date
stage: resolved
2014-09-12 22:38:00terry.reedysetnosy: + terry.reedy
messages: + msg226848
2014-09-12 22:13:24terry.reedylinkissue22375 superseder
2014-09-10 12:00:20alanoesetmessages: + msg226689
2014-09-09 21:53:40alanoecreate