Problems with FTP

Benjamin Kaplan benjamin.kaplan at case.edu
Fri Jan 21 15:19:58 EST 2011


On Fri, Jan 21, 2011 at 3:01 PM, RizlaJ <razajaffrey77 at gmail.com> wrote:
> Hi Tom, Giampaolo,
>
> Thank you both for your swift replies. I have asked our IT dept to see
> if it is the firewall that is blocking the FTP. They are working on
> that side of things.
>
> However I would have thought that the following or some version of it
> would have worked:-
>
>>>> import urllib
>>>> proxies = ({'ftp':proxyserveraddress'})
>>>> some_url = ({'ftp':'indexftp.barcap.com'})
>>>> filehandle = urllib.urlopen(some_url, proxies=proxies)
>
> Traceback (most recent call last):
>  File "<pyshell#51>", line 1, in <module>
>    filehandle = urllib.urlopen(some_url, proxies=proxies)
>  File "C:\Python27\lib\urllib.py", line 84, in urlopen
>    return opener.open(url)
>  File "C:\Python27\lib\urllib.py", line 177, in open
>    fullurl = unwrap(toBytes(fullurl))
>  File "C:\Python27\lib\urllib.py", line 1026, in unwrap
>    url = url.strip()
> AttributeError: 'dict' object has no attribute 'strip'
>
> However as you can see there is an error - is this again related to
> the firewall do you think?
>
> Sorry for asking stupid questions! and thank you for your help in
> advance.


The one has nothing to do with a firewall. It's telling you that the
function is trying to call url.strip(). But url is a dict object which
doesn't have a strip method. Which should tell you that some_url is
being constructed incorrectly- it's supposed to be a string.

> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list