Search code examples
pythonftppyftpdlib

pyftpdlib import error on windows


I want to set up an ftp server on windows using pyftpdlib when sudenly i get error message.

I want to run this:

from pyftpdlib.handlers import FTPHandler
from pyftpdlib.servers import FTPServer
from pyftpdlib.contrib.authorizers import WindowsAuthorizer

authorizer = WindowsAuthorizer()
authorizer = WindowsAuthorizer(anonymous_user="guest", anonymous_password="1234")
handler = FTPHandler
handler.authorizer = authorizer
server = FTPServer(('', 2121), handler)
server.serve_forever()

But when i want to import "WindowsAuthorizer" i got this error message:

from pyftpdlib.contrib.authorizers import WindowsAuthorizer c:\Program Files\Python27\lib\site-packages\pyftpdlib\contrib__init__.py:3: Dep recationWarning: pyftpdlib.contrib namespace is deprecated
_depwarn("pyftpdlib.contrib namespace is deprecated") c:\Program Files\Python27\lib\site-packages\pyftpdlib\contrib\authorizers.py:35: DeprecationWarning: pyftpdlib.contrib.authorizers module is deprecated; use pyf tpdlib.authorizers instead
_depwarn("pyftpdlib.contrib.authorizers module is deprecated; "

I really dont know what is the problem, i have had installed pywin32 already.


Solution

  • This looks like a warning, not an error

    there is print in the code, which says like this

    _depwarn("pyftpdlib.contrib.authorizers module is deprecated; "
             "use pyftpdlib.authorizers instead")
    

    which means this statement should be changed from

    from pyftpdlib.contrib.authorizers import WindowsAuthorizer
    

    to

    from pyftpdlib.authorizers import WindowsAuthorizer