Monday, May 18, 2015

PyInstaller for Converting Python Script to Windows Executables

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 FTPServer
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()
Here is my conversation output:

> 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! 



2 comments:

  1. Sports Betting at Safest Betting Sites in Israel - Airjordan10 RetroOutlet
    Safest Betting Sites in Israel · The Best and top air jordan 18 stockx Best air jordan 18 retro varsity red from me Betting Sites 먹튀검증 사이트 샤오미 in the UK air jordan 18 retro men blue shipping · The UK's website to buy air jordan 18 retro yellow Hottest Bookmakers · Betfair Sports Betting Authority · Betfair

    ReplyDelete