Learn, Share, Build

353
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
    self.path_not_exit(False)
  File "/usr/lib/python3.4/site-packages/FTPwalker/runwalker.py", line 157, in path_not_exit
    self.m_walker.Process_dispatcher(False)
  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__
    self.connect(host)
  File "/usr/lib64/python3.4/ftplib.py", line 153, in connect
    source_address=self.source_address)
  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")
walker.check_state()

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

Rent Charter Buses Company
READ ALSO
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

271
Learn, Share, Build

Learn, Share, Build

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

273
Learn, Share, Build

Learn, Share, Build

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

254
Learn, Share, Build

Learn, Share, Build

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

221