[issue17933] test_ftp failure / ftplib error formatting issue
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17933 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17933] test_ftp failure / ftplib error formatting issue
Giampaolo Rodola' added the comment: I cannot reproduce the issue on Ubuntu. As for the second exception I think it's safe to just do: - raise URLError('ftp error: %d' % reason) from reason + raise URLError('ftp error: %s' % reason) from reason (will commit that later) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17933 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17933] test_ftp failure / ftplib error formatting issue
Rock Lee added the comment: Bug in urllib/request.py. format string formatted error type variable 2373 except ftplib.error_perm as reason: 2374 raise URLError('ftp error: %d' % reason) from reason variable reason here is a instance of class ftplib.error_perm. We need to passed in a integer object. Patch supplied. -- keywords: +patch nosy: +rock Added file: http://bugs.python.org/file30967/urllib-request-format-type-bug.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17933 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17933] test_ftp failure / ftplib error formatting issue
Rock Lee added the comment: Fixed like this: raise URLError('ftp error: %d' % int(str(reason)[:3])) from reason I think this is the original author's intention. Actually, need to fix two places in urllib/request.py -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17933 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17933] test_ftp failure / ftplib error formatting issue
Giampaolo Rodola' added the comment: That's not safe as a misbehaving FTP server might not send a response code at all (highly unlikely but still...). Furthermore having the complete server response (response code + accompaining message) is a lot more helpful. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17933 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17933] test_ftp failure / ftplib error formatting issue
Rock Lee added the comment: yes, the malformed server could do evil things. If we need to cover this situation, we need to some extra fixes in this file. Maybe the exception message look like this is the better one ? ftplib.error_perm: 550 Failed to change directory -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17933 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17933] test_ftp failure / ftplib error formatting issue
Giampaolo Rodola' added the comment: I think raise URLError('ftp error: %s' % reason) from reason is just fine. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17933 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17933] test_ftp failure / ftplib error formatting issue
Rock Lee added the comment: Yes, the simplest fix is just replace '%d' to '%s'. Line 2362 and 2374 all need to modify. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17933 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17933] test_ftp failure / ftplib error formatting issue
New submission from Antoine Pitrou: The following error appeared on some buildbots: http://buildbot.python.org/all/builders/x86%20Gentoo%203.x/builds/4195/steps/test/logs/stdio == ERROR: test_ftp (test.test_urllib2net.OtherNetworkTests) -- Traceback (most recent call last): File /var/lib/buildslave/3.x.murray-gentoo/build/Lib/urllib/request.py, line 2337, in retrfile self.ftp.cwd(file) File /var/lib/buildslave/3.x.murray-gentoo/build/Lib/ftplib.py, line 622, in cwd return self.voidcmd(cmd) File /var/lib/buildslave/3.x.murray-gentoo/build/Lib/ftplib.py, line 272, in voidcmd return self.voidresp() File /var/lib/buildslave/3.x.murray-gentoo/build/Lib/ftplib.py, line 245, in voidresp resp = self.getresp() File /var/lib/buildslave/3.x.murray-gentoo/build/Lib/ftplib.py, line 240, in getresp raise error_perm(resp) ftplib.error_perm: 550 Failed to change directory. During handling of the above exception, another exception occurred: Traceback (most recent call last): File /var/lib/buildslave/3.x.murray-gentoo/build/Lib/test/test_urllib2net.py, line 112, in test_ftp self._test_urls(urls, self._extra_handlers()) File /var/lib/buildslave/3.x.murray-gentoo/build/Lib/test/test_urllib2net.py, line 218, in _test_urls f = urlopen(url, req, TIMEOUT) File /var/lib/buildslave/3.x.murray-gentoo/build/Lib/test/test_urllib2net.py, line 33, in wrapped return _retry_thrice(func, exc, *args, **kwargs) File /var/lib/buildslave/3.x.murray-gentoo/build/Lib/test/test_urllib2net.py, line 23, in _retry_thrice return func(*args, **kwargs) File /var/lib/buildslave/3.x.murray-gentoo/build/Lib/urllib/request.py, line 462, in open response = self._open(req, data) File /var/lib/buildslave/3.x.murray-gentoo/build/Lib/urllib/request.py, line 480, in _open '_open', req) File /var/lib/buildslave/3.x.murray-gentoo/build/Lib/urllib/request.py, line 440, in _call_chain result = func(*args) File /var/lib/buildslave/3.x.murray-gentoo/build/Lib/urllib/request.py, line 1464, in ftp_open fp, retrlen = fw.retrfile(file, type) File /var/lib/buildslave/3.x.murray-gentoo/build/Lib/urllib/request.py, line 2339, in retrfile raise URLError('ftp error: %d' % reason) from reason TypeError: %d format: a number is required, not error_perm -- components: Library (Lib), Tests messages: 188699 nosy: giampaolo.rodola, pitrou, r.david.murray priority: high severity: normal stage: needs patch status: open title: test_ftp failure / ftplib error formatting issue type: behavior versions: Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17933 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com