Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ftplib python - returning error that login or password is incorrect

I am trying to use the python library "ftplib". I am able to connect to the FTP server on my MacBook just fine, using the finder settings under "Go --> Connect to Server..."

When I use ftplib in a jupyter notebook it is returning the error message:

error_perm: 530 Login or password incorrect!

Here is my code:

from ftplib import FTP
ftp = FTP(host='ipaddress', user='myusername', passwd='mypassword')

where host is the ip address of the FTP server and user is my username and passwd is the password I was given. Thank you for any help.

like image 947
Michael Mathews Jr. Avatar asked Nov 24 '20 18:11

Michael Mathews Jr.


2 Answers

I have solved the issue. I was not on the "user list" for the server. I was able to login through my finder on Mac but Filezilla did not let me connect through python until I was added to the server user list. Bush league by our tech department, they could use an injection of talent over there.

like image 142
Michael Mathews Jr. Avatar answered Oct 13 '22 21:10

Michael Mathews Jr.


The code you provide should work. I tried it on my own FTP.
Is the username and password correct?
You receive the error ftplib.error_perm: 530 Login incorrect. when the credentials are not OK.

from ftplib import FTP, error_perm

if __name__ == "__main__":
    ftp_host = "your_host"
    username = "your_user"
    password = "your_pwd"
    try:
        ftp = FTP(host=ftp_host, user=username, passwd=password)
    except error_perm as e:
        print("Credentials are bad!")
like image 35
François B. Avatar answered Oct 13 '22 20:10

François B.