Dhaval Talpada
Dhaval Talpada

Reputation: 23

Python ftplib Library is not working for localhost

I have used ftplib library to connect with server to push and pull file. It works fine with server but it generate error when i try to connect with localhost on port 21 or 22.

self.client.connect(self.host,self.port)

  File "/usr/lib/python2.7/ftplib.py", line 138, in connect

    self.welcome = self.getresp()

  File "/usr/lib/python2.7/ftplib.py", line 215, in getresp

    resp = self.getmultiline()

  File "/usr/lib/python2.7/ftplib.py", line 205, in getmultiline

    nextline = self.getline()


  File "/usr/lib/python2.7/ftplib.py", line 191, in getline

if not line: raise EOFError
EOFError

Upvotes: 2

Views: 490

Answers (1)

Jignesh Jarsaniya
Jignesh Jarsaniya

Reputation: 589

You have to follow below step in order to allow localhost connection in ftplib

1. Install vsftpd if it is not installed
2. Configure vsftpd.cofig file
3. set anonymous_enable to YES
4. Restart vsftpd service

Now you can use ftplib library for loaclhost to push and pull file from local FTP.

Upvotes: 4

Related Questions