[issue8582] urllib.urlretrieve fails with ValueError: Invalid format string

Jason Gross report at bugs.python.org
Fri Apr 30 23:06:37 CEST 2010


New submission from Jason Gross <jasongross9 at gmail.com>:

When calling urllib.urlretrieve with a data:image/png url (possibly with other urls too) and a local file name, it fails with
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    urlretrieve(url, file_name)
  File "D:\Python26\Lib\urllib.py", line 93, in urlretrieve
    return _urlopener.retrieve(url, filename, reporthook, data)
  File "D:\Python26\Lib\urllib.py", line 237, in retrieve
    fp = self.open(url, data)
  File "D:\Python26\Lib\urllib.py", line 205, in open
    return getattr(self, name)(url)
  File "D:\Python26\Lib\urllib.py", line 596, in open_data
    time.gmtime(time.time())))

This can be fixed by replacing %T on line 595 with %H : %M : %S (which I found as the definition of %T on http://www.opengroup.org/onlinepubs/009695399/functions/strftime.html)

----------
components: Library (Lib)
messages: 104664
nosy: Jason.Gross
priority: normal
severity: normal
status: open
title: urllib.urlretrieve fails with ValueError: Invalid format string
type: crash
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8582>
_______________________________________


More information about the Python-bugs-list mailing list