我正在使用 pyftpdlib 制作一个 Web 服务器,但由于某种原因,该add_user()
功能不起作用并给了我一个错误代码:
from pyftpdlib.authorizers import DummyAuthorizer
from pyftpdlib.handlers import FTPHandler
from pyftpdlib.servers import FTPServer
ip = socket.gethostbyname(socket.gethostname())
PATH = 'C:/Users/cuerv/Downloads/My code/Camera/Recordings'
os.chdir(PATH)
addr = (ip,21)
authorizer = DummyAuthorizer
authorizer.add_user('admin','adminpass','.',perm='elradfmw')
handler = FTPHandler
handler.authorizer = authorizer
server = FTPServer(addr,handler)
server.serve_forever()
错误:
File "C:/Users/cuerv/Downloads/My code/Camera/test.py", line 12, in <module>
authorizer.add_user('admin','adminpass','.',perm='elradfmw')
TypeError: add_user() missing 1 required positional argument: 'homedir'```