[Tutor] URLLIB

Kent Johnson kent37 at tds.net
Mon May 16 13:46:04 CEST 2005


Please post the code that gave you the error.

Kent

Servando Garcia wrote:
> I tired that and here is the error I am currently getting:
> 
> assert hasattr(proxies, 'has_key'), "proxies must be a mapping"
> 
> I was trying this:
> 
>>> X=urllib.URLopener(name,proxies={'http':'URL').distutils.copy_file('So 
>>> meFileName')
> 
> 
> in hopes to solve the above error
> 
> 
> 
> On May 13, 2005, at 6:52 AM, Kent Johnson wrote:
> 
>> Servando Garcia wrote:
>>
>>> Hello list
>>> I am on challenge 5. I think I need to some how download a file. I  
>>> have been trying like so
>>> X=urllib.URLopener(name,proxies={'http':'URL').distutils.copy_file('So 
>>> meFileName')
>>
>>
>> urlopener() returns a file-like object - something that behaves like  
>> an open file. Try
>> x = urllib.urlopener(name)
>> data = x.read()
>>
>> Kent
>>
>>
> 
> 



More information about the Tutor mailing list