1

I am trying to connect to an FTP server in a python script. I can access the FTP server from the browser without issue, but when I try to run the following:

ftp = FTP('garner.ucsd.edu')
ftp.cwd('pub/products')

it fails with error_perm: 530 Please login with USER and PASS.

But I don't have a username and password for this FTP--how come my browser seems to get past this authentication just fine?

1 Answer 1

1

It turns out that Firefox was automatically authenticating with empty strings for the username and password.

These are the default arguments in ftp.login, so the following fixes the script:

ftp = FTP('garner.ucsd.edu')
ftp.login()
ftp.cwd('pub/products')

This is actually in the Python documentation too, I just didn't realize it was actually necessary.

3
  • 1
    @ρss I know--it says I will be able to accept in 2 days.
    – Brian
    Dec 30, 2015 at 20:14
  • It shouldn't be 2 days, it should be 15 minutes
    – Barmar
    Dec 30, 2015 at 20:49
  • @Barmar I think the 2-day limit is only for self-answered questions.
    – MattDMo
    Dec 30, 2015 at 21:20

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.