New submission from Alan Evangelista:
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
----------
components: Library (Lib)
messages: 226664
nosy: alanoe
priority: normal
severity: normal
status: open
title: urllib2.urlopen().read().splitlines() opening a directory in a FTP
server randomly returns incorrect result
type: behavior
versions: Python 2.7
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue22376>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com