I have always known about Py2Exe as a way to convert Python script to Windows executable. Recently I had a need to convert a simple Python FTP script to a Windows device. Py2Exe module did not work for me, searching for the error did not reveal too much information about the error itself, but rather another tool that 'just works'. The tool is called PyInstaller and at least for me, works out of the box.
Here is my FTP script following this Stackoverflow post: http://stackoverflow.com/questions/24586016/
from pyftpdlib.authorizers import DummyAuthorizerfrom pyftpdlib.handlers import FTPHandlerfrom pyftpdlib.servers import FTPServerHere is my conversation output:
authorizer = DummyAuthorizer()authorizer.add_user("user", "12345", ".", perm='elradfmwM')authorizer.add_anonymous(".", perm='elradfmwM')
handler = FTPHandlerhandler.authorizer = authorizer
server = FTPServer(("0.0.0.0", 2121), handler)server.serve_forever()
> pyinstaller.exe .\my_ftp.py
31 INFO: wrote <path>\my_ftp\my_ftp.spec
47 INFO: Testing for ability to set icons, version resources...
In the dist folder of the newly created my_ftp folder will contain the .exe file.
Happy coding!
No comments:
Post a Comment