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

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

sorry @shazow, I edited the question. Im using ftplib for connecting to ftp.
Ah. You should untag urllib3 and maybe tag ftplib instead. :)
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) 

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.