tag:blogger.com,1999:blog-3317681194976291894.post8843376322416096003..comments2023-03-27T00:43:40.769-07:00Comments on Able Pear Software: Bundling Python files into a stand-alone executableAble Pearhttp://www.blogger.com/profile/10972026256260166617noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-3317681194976291894.post-3059900549950413072016-08-01T15:56:30.069-07:002016-08-01T15:56:30.069-07:00I haven't tested that, but I don't see why...I haven't tested that, but I don't see why not. Just compile all your .py files to .pyc and only include the compiled ones in the zip.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3317681194976291894.post-35203172604826790392016-07-27T20:00:37.161-07:002016-07-27T20:00:37.161-07:00Ok and if you want to ensure you only include comp...Ok and if you want to ensure you only include compiled bytecode instead of exposing .py files....is this still the way to go?Nick Kayhttps://www.blogger.com/profile/16536129727446039055noreply@blogger.comtag:blogger.com,1999:blog-3317681194976291894.post-78984099018051624032014-11-13T12:12:34.923-08:002014-11-13T12:12:34.923-08:00to avoid having to include pkg_resources just use ...to avoid having to include pkg_resources just use pkgutil.get_data() to access resources:<br /><br />print(StringIO.StringIO(pkgutil.get_data('resources', 'inFrance.txt')))<br /><br />pkg_resources uses pkgutil.get_data() anyway .. and watch out if loading unicode in python2, pkgutil.get_data returns binary data!Anonymoushttps://www.blogger.com/profile/14855687363713186046noreply@blogger.comtag:blogger.com,1999:blog-3317681194976291894.post-90895836324436051252014-04-29T10:40:47.754-07:002014-04-29T10:40:47.754-07:00Cool stuff.Cool stuff.Rhitikhttps://www.blogger.com/profile/07340627089735445864noreply@blogger.comtag:blogger.com,1999:blog-3317681194976291894.post-39613624652261598322013-04-12T15:22:06.106-07:002013-04-12T15:22:06.106-07:00Don't feel bad about missing the __main__.py f...Don't feel bad about missing the __main__.py feature. It came out in python 2.6 (the docs saying 2.5 are in error) and they didn't do a great job of advertising and explaining it.<br /><br />Thanks for the post though. It gave me a good feeling of "suffering together" i.e. I'm not doing this part completely wrong, it's just weird in ways.Anonymoushttps://www.blogger.com/profile/18293281284863700642noreply@blogger.comtag:blogger.com,1999:blog-3317681194976291894.post-66547825416046733342012-10-18T11:22:15.598-07:002012-10-18T11:22:15.598-07:00@WinCrazy That's good to know. Is PY2EXE part...@WinCrazy That's good to know. Is PY2EXE part of the standard Python distribution on Windows?<br /><br />Given that Windows doesn't include Python by default like OS X and most Linux/UNIX systems, bundling Python.exe and the needed standard library files is probably the best way to go for distributing to Windows users.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3317681194976291894.post-85287999566074119432012-10-18T10:47:14.186-07:002012-10-18T10:47:14.186-07:00The best way to make an EXE in MSW is to use PY2EX...The best way to make an EXE in MSW is to use PY2EXE. It packages the python interpreter DLL and every dependent file. It also makes this entire discussion moot !<br /><br />The downside to PY2EXE is that the simplest EXE will be 3 or 4 MB in size. However, disk space is extremely inexpensive these days.WinCrazyhttps://www.blogger.com/profile/16259119756851287084noreply@blogger.comtag:blogger.com,1999:blog-3317681194976291894.post-33905560650401637392012-10-16T08:11:09.454-07:002012-10-16T08:11:09.454-07:00The quick and easy way is to give the zip file a u...The quick and easy way is to give the zip file a unique extension, like ".pyexe" and create an association between Python and that extension.<br /><br />The slicker way would be to create a small executable in C that searches the directories on the PATH environment variable until it finds Python.exe, then executes Python with the path to the small executable. Then you would embed the Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3317681194976291894.post-70457969728776486222012-10-16T02:05:42.813-07:002012-10-16T02:05:42.813-07:00Nice and useful post! Is there a way to solve that...Nice and useful post! Is there a way to solve that last step (making the executable) in Windows?Davidehttps://www.blogger.com/profile/16434398577321853431noreply@blogger.com