Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6192485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:57:04+00:00 2026-05-24T02:57:04+00:00

I’m looking into using ftplib (and possibly ftputil ) for doing some automated FTP

  • 0

I’m looking into using ftplib (and possibly ftputil) for doing some automated FTP file syncing. I have a couple of servers to test this against at the moment, but, whilst I’m having a successful conversation with both servers, I get EOFError-s with each error reply. For example: if I try to log in with an incorrect user/pass, I will get the 530 response with everything… but I also get an EOFError; if I login with a correct user/pass or try to dir() after doing so etc., I get no EOFError.

It seems to only appear with error messages. I strongly suspect this may be caused by the servers rather than python: I’ve not found any mention of this issue elsewhere. I, however, have very little control over the server setup.

I’m asking for ideas:

  • Do you know what could be causing the error in the first place?
  • If it’s server-side, could you be more specific? I won’t know if I’ll be able to do anything about it until I know what it is…
  • How do you think I should handle this? I guess I could add an except EOFError: pass before each time I handle an exception, but if you have better/neater ideas I would love to hear them.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T02:57:05+00:00Added an answer on May 24, 2026 at 2:57 am

    The servers are sending EOF to tell you that they’ve terminated the connection.

    You should treat this no differently than any other disconnection event, except that obviously you need to handle it with except EOFError.

    See the source, from http://svn.python.org/view/python/trunk/Lib/ftplib.py?view=markup

    # Internal: return one line from the server, stripping CRLF.
    # Raise EOFError if the connection is closed
    182     def getline(self):
    183         line = self.file.readline()
    184         if self.debugging > 1:
    185             print '*get*', self.sanitize(line)
    186         if not line: raise EOFError
    187         if line[-2:] == CRLF: line = line[:-2]
    188         elif line[-1:] in CRLF: line = line[:-1]
    189         return line
    

    EOFError is only raised when readline() on the connection returns a blank line, which the comment indicates is a disconnection event.

    Edit in re your comment:

    The server doesn’t send an empty line. readline() returns everything up to the next \n or \r or \r\n or all of the abouve depending on how it’s configured. In this case, there is nothing to read because the end of the file has been reached. This causes readline() to return a blank line, it doesn’t mean a blank line has been read. If a blank line had been read, readline() would return the character that ended the line (\n or \r or \n\r).

    If you don’t get the exception when using FTPUtil, that is because it handles it internally.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I have some data like this: 1 2 3 4 5 9 2 6
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have thousands of HTML files to process using Groovy/Java and I need to
I have a reasonable size flat file database of text documents mostly saved in
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.