You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Customer's machine has some windows inside and also some ftp client.
This client periodically connects to my ftp server (based on pyftpdlib) to read requests and to store results.
The trouble is that the client runs on Windows while the server runs on Linux.
When the client sends ftp command
LIST requests_dir\*.*
then the server doesn't understand it.
(When I used FileZilla server on Windows then it was ok.)
I made following modifications to make it working.
handlers.py: FTPHandler.ftp_LIST():
(When there is * in path then I use glob library to get a list.)
...
ifisdiror"*"inpath:
if"*"inpath:
basedir, filename=os.path.split(path)
importgloblisting=glob.glob(path)
foriinrange(len(listing)):
basedir, listing[i] =os.path.split(listing[i])
else:
listing=self.run_as_current_user(self.fs.listdir, path)
basedir=path#print "basedir", basedir, "listing", listingifisinstance(listing, list):
try:
# RFC 959 recommends the listing to be sorted.listing.sort()
exceptUnicodeDecodeError:
# (Python 2 only) might happen on filesystem not# supporting UTF8 meaning os.listdir() returned a list# of mixed bytes and unicode strings:# http://goo.gl/6DLHD# http://bugs.python.org/issue683592passiterator=self.fs.format_list(basedir, listing)
else:
basedir, filename=os.path.split(path)
#print "basedir", basedir, "filename", filenameself.fs.lstat(path) # raise exc in case of problemsiterator=self.fs.format_list(basedir, [filename])
...
filesystems.py: AbstractedFS.ftpnorm():
(Always replace backslash. Not very smart, should be by some parameter.)
...
# normalize string in a standard web-path notation having '/'# as separator.ifTrueoros.sep=="\\":
p=p.replace("\\", "/")
...
It is up to you whether you would get inspired by these modifications.
But they are necessary for me.
(edited formatting)
The text was updated successfully, but these errors were encountered:
Customer's machine has some windows inside and also some ftp client.
This client periodically connects to my ftp server (based on pyftpdlib) to read requests and to store results.
The trouble is that the client runs on Windows while the server runs on Linux.
When the client sends ftp command
then the server doesn't understand it.
(When I used FileZilla server on Windows then it was ok.)
I made following modifications to make it working.
handlers.py: FTPHandler.ftp_LIST():
(When there is * in path then I use glob library to get a list.)
filesystems.py: AbstractedFS.ftpnorm():
(Always replace backslash. Not very smart, should be by some parameter.)
It is up to you whether you would get inspired by these modifications.
But they are necessary for me.
(edited formatting)
The text was updated successfully, but these errors were encountered: