1

Im using this code to connect and to get list of directory from a ftp. It works but in some computer I receive ftplib.error_proto: 150. Whats the meaning of this error? Is this error due to anti-virus or permission issues? My os is windows xp.

-Edited

#http_pool = urllib3.connection_from_url(myurl)
#r1 = http_pool.get_url(myurl)
#print r1.data

Sorry I post the wrong code above. Im using ftplib

self.ftp = FTP(webhost)
self.ftp.login(username, password)
x = self.ftp.retrlines('LIST')

Error message:

File "ftplib.pyo", line 421, in retrlines
File "ftplib.pyo", line 360, in transfercmd
File "ftplib.pyo", line 329, in ntransfercmd
File "ftplib.pyo", line 243, in sendcmd
File "ftplib.pyo", line 219, in getresp
ftplib.error_proto: 150

thanks

unice
  • 2,655
  • 5
  • 43
  • 78

2 Answers2

1

Unfortunately urllib3 does not support the FTP protocol. We've given some thought of adding support for more protocols but it's not going to happen soon.

For FTP, have a look at things like ftplib or one of the many options on PyPI.

shazow
  • 17,147
  • 1
  • 34
  • 35
0

I was getting the same error. I tried following the same processes through console. For me this error was being thrown when there was a network connection issue. I wrote a a funtion with decorator retrying. To keep on retrying connecting with remort until successful:

Example:

    @retry(wait_random_min=1000, wait_random_max=2000)
    def connect_to_remort(self)

        self.ftp = FTP(webhost)
        self.ftp.login(username, password)
        x = self.ftp.retrlines('LIST')
        print(x) 
Sheece Gardazi
  • 480
  • 6
  • 14