from __future__ import print_function
import ftplib
-from m_lib.net.ftp.ftpparse import ftpparse
+from .ftpparse import ftpparse
class FtpScanError(Exception): pass
ftp = ReconnectingFTPWrapperClass(ftp, ftp_server, ftp_port, login, password, ftp_dir, tree)
ftp.connect(ftp_server, ftp_port)
ftp.login(login, password)
- if ftp_dir <> '/':
+ if ftp_dir != '/':
ftp.cwd(ftp_dir)
_traverse_ftp(ftp, tree, ftp_dir)
ftp.set_pasv(passive)
ftp.connect(ftp_server, ftp_port)
ftp.login(login, password)
- if ftp_dir <> '/':
+ if ftp_dir != '/':
ftp.cwd(ftp_dir)
lines = []
# The server does not implement LIST -R and
# treats -R as a name of a directory (-:
ftp.quit()
- raise FtpScanError, "the server does not implement recursive listing"
+ raise FtpScanError("the server does not implement recursive listing")
ftp.quit()
tree = []
tree.append((current_dir, files))
if line[:2] == "./":
line = line[1:] # remove leading dot
- elif line[0] <> '/':
+ elif line[0] != '/':
line = '/' + line
current_dir = line[:-1]
files = []
tree.append((current_dir, files))
if len(tree) == 1:
- raise FtpScanError, "the server ignores -R in LIST"
+ raise FtpScanError("the server ignores -R in LIST")
return tree