Sorry, if this sounds too basic or if there is a duplicate which I haven't found during my search:
For example, these were not helpful:
- Python ftplib WinError 10060
- Python FTP cannot connect, but using client like FileZilla with same credentials works
And the examples of ftplib or from other tutorials are not working for me and the documentation is more confusing than helpful.
I must be doing something elementary wrong, or maybe there are special settings with my network configuration which might prevent ftplib from working properly? My configuration. Python 3.6.3 on Win10.
My question: what's wrong with the following code?
import ftplib
host = '0.0.0.0'
user = 'user'
passwd = 'XXXX'
with ftplib.FTP(host=host, user=user, passwd=passwd) as ftp:
print(ftp.dir())
After some time, I get the error message:
TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
Different approach using plink:
However, the following using plink works fine for me in the command line.
So, there doesn't seem to be anything wrong with the host, user or password or connection.
plink -ssh -batch user@0.0.0.0 -pw XXXX "cd SubDir/SubSubDir/; ls"
But instead of messing around with plink and subprocess, I thought ftplib might be more convenient. Thank you for hints.