Download unnamed web image?

John Bokma john at castleamber.com
Tue Feb 16 22:11:24 EST 2010


galileo228 <mattbarkan at gmail.com> writes:

> On Feb 16, 9:40 pm, galileo228 <mattbar... at gmail.com> wrote:

[...]

> I've now fixed the foo3 issue, and I now know that the problem is with
> the urllib.urlretrieve line (see above). This is the error msg I get
> in IDLE:
>
> Traceback (most recent call last):
>   File "/Users/Matt/Documents/python/dtest.py", line 59, in <module>
>     urllib.urlretrieve(foo4, save_as)
>   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/urllib.py", line 94, in urlretrieve
>     return _urlopener.retrieve(url, filename, reporthook, data)
>   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/urllib.py", line 226, in retrieve
>     url = unwrap(toBytes(url))
>   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/urllib.py", line 1033, in unwrap
>     url = url.strip()
> TypeError: 'NoneType' object is not callable
>
> Is this msg being generated because I'm trying to retrieve a url
> that's not really a file?

--8<---------------cut here---------------start------------->8---
>>> import urllib;
>>> urllib.urlretrieve(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/urllib.py", line 89, in urlretrieve
    return _urlopener.retrieve(url, filename, reporthook, data)
  File "/usr/lib/python2.5/urllib.py", line 210, in retrieve
    url = unwrap(toBytes(url))
  File "/usr/lib/python2.5/urllib.py", line 1009, in unwrap
    url = url.strip()
AttributeError: 'NoneType' object has no attribute 'strip'
--8<---------------cut here---------------end--------------->8---

To me it looks like you're still calling urlretrieve with None as a
first value.

-- 
John Bokma                                                               j3b

Hacking & Hiking in Mexico -  http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development



More information about the Python-list mailing list