Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/asyncore.py", line 83, in read
obj.handle_read_event()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/asyncore.py", line 442, in handle_read_event
self.handle_read()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/asynchat.py", line 158, in handle_read
self.found_terminator()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/pyftpdlib/ftpserver.py", line 1996, in
found_terminator
self.process_command(cmd, arg)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/pyftpdlib/ftpserver.py", line 2005, in
process_command
method(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/pyftpdlib/ftpserver.py", line 2643, in
ftp_RETR
fd = self.run_as_current_user(self.fs.open, file, 'rb')
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/pyftpdlib/ftpserver.py", line 2253, in
run_as_current_user
return function(*args, **kwargs)
File "../ftptest.py", line 14, in open
raise OSError(errno.ENOENT)
OSError: 2
obtained with the ftptest.py file :
import os
import errno
from pyftpdlib import ftpserver
class CustomizedFS(ftpserver.AbstractedFS):
def listdir(self, path):
ls = os.listdir(path)
return [x for x in ls if not x.endswith('.zip')]
def open(self, path, mode):
if "r" in mode and path.endswith('.zip'):
raise OSError(errno.ENOENT)
return open(path, mode)
authorizer = ftpserver.DummyAuthorizer()
authorizer.add_anonymous(os.getcwd())
handler = ftpserver.FTPHandler
handler.authorizer = authorizer
handler.abstracted_fs = CustomizedFS
server = ftpserver.FTPServer(('192.168.1.2', 2121), handler)
server.serve_forever()