1

The following code works flawlessly in Linux, retrieving the list of folders/files available in the FTP server:

from ftplib import FTP
server = FTP('ftp.ibge.gov.br')
server.connect()
server.login()
server.nlst()

However, in Windows 10, I get the server welcome message after connect() and the '230 login successful" message, but when I try to send any command to the server - like server.nlst() or server.dir() - socket.py raises a TimeoutError [WinError 10060]

I am 100% sure that the server is up, and in Linux server.nlst() retrieves the information fast as lightning - so, it is not a "true" timeout error, if I set timeout=1000, or larger, I get the same error.

What is wrong?

Paulie-C
  • 1,674
  • 1
  • 13
  • 29
RGosorio
  • 11
  • 3
  • Check firewall on both sides. Disable antivirus. Compare FTP server log for Windows and Linux clients. – viilpe Sep 23 '21 at 20:40
  • I do not have access to the FTP server. The problem persists even if the firewall is fully disabled. I have no problem using Filezilla or the native Windows command line ftp app. – RGosorio Sep 23 '21 at 21:30

1 Answers1

0

An explanation of the problem can be found here: passive reply with unroutable address

It seems that 'ftp.ibge.gov.br' is not properly configured.

Luckily, I found a working solution.

However, it seems that ftplib is not able to handle this problem in Windows only. With Linux, I have been accessing files from this server for years using ftplib

RGosorio
  • 11
  • 3