Learn, Share, Build

October 05, 2017, at 4:13 PM

I'm trying to traverse an ftp directory using FTPwalker, however I cannot connect.

The current call is being used:

walker = ftpwalker(server_name="hostname", url="ftp://username:password@hostname")

However walker.check_state() gives:

>> walker.check_state()
Find leading...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.4/site-packages/FTPwalker/runwalker.py", line 100, in check_state
  File "/usr/lib/python3.4/site-packages/FTPwalker/runwalker.py", line 157, in path_not_exit
  File "/usr/lib/python3.4/site-packages/FTPwalker/main_walker.py", line 82, in Process_dispatcher
    leadings = self.find_leading_dirs(self.root)
  File "/usr/lib/python3.4/site-packages/FTPwalker/main_walker.py", line 37, in find_leading_dirs
    files, dirs = self.run_object.find_leading(top)
  File "/usr/lib/python3.4/site-packages/FTPwalker/traverse.py", line 75, in find_leading
    conn = ftplib.FTP(self.server_url)
  File "/usr/lib64/python3.4/ftplib.py", line 118, in __init__
  File "/usr/lib64/python3.4/ftplib.py", line 153, in connect
  File "/usr/lib64/python3.4/socket.py", line 498, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib64/python3.4/socket.py", line 537, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

Is the url parameter entered here in the correct format? Pinging the hostname works.

Answer 1

While the parameter is misleadingly named url, the official example shows pretty clearly, that the value should actually be a plain hostname:

from FTPwalker.runwalker import ftpwalker
walker = ftpwalker("Uniprot", "ftp.uniprot.org")

In the the end, the value goes to ftplib.FTP.connect, which takes "hostname".

Rent Charter Buses Company
Learn, Share, Build

Learn, Share, Build

I am trying to use the BeautifulSoup library in Python to extract the jpg image names from a html scriptIn the url wherever you find srcset it is always proceeded by a jpg file name

Learn, Share, Build

Learn, Share, Build

I try to connect mongodb database using mongoengine with dynamic connectioni getting database name from URL Request

Learn, Share, Build

Learn, Share, Build

I have a code block within transactionatomic() within a view

Learn, Share, Build

Learn, Share, Build

I have the following requirement to validate the password with below context