Hello:

** I have been researching and experimenting with this with tutorials from many sources but can not even begin it to get it to work it seems.

I have a very small yet important Python program that I must make into an executable file within a week's time or so; my boss leaves for Tokyo to meet with a large video game company and this will be a simple game promo which will be transported via a laptop.

I have all the correct files (as far as I can tell) necessary to create a Py2Exe file but I am unable to build it: some tutorials deal only with Command Line (my system cannot find the right files using this for some odd reason + I am not greatly proficient with Command Line, unfortunately)

Everything I have read lauds Py2Exe's ease of use but I find this to be to the contrary. Making executables from Python seems like a great touch to finish off a program especially for a professional presentation. I would really like to figure this out. It is most important.

I only need assistance with the exe-- the program is in itself complete.

Thank-you in advance very much to anyone that can help me solve this.

sharky_machine

Recommended Answers

All 17 Replies

1) Py2Exe is not easy to use!

2) Have you looked at the Py2Exe snippet at Daniweb? That should make it easier to use!

3) Have you been able to package any Python code into an exe?

4) Your program might be small, but there are some 'outhouse' modules that don't do well.

Hey Sharky, maybe something like this is what you are looking for.

commented: always helpful and a good member of Daniweb- Sharky +1

Ene Uran & ~S.O.S.~ :

Thank-you for your replies.

I am going to try the [Daniweb] snippet (it looks promising) and also I am going to try the link that ~S.O.S.~ supplied :). Between both of these, I will hopefully get some results.

Thanks again for your help. Much appreciated ;)

Regards,

sharky_machine

Ene Uran & ~S.O.S.~ :

Thank-you for your replies.

I am going to try the [Daniweb] snippet (it looks promising) and also I am going to try the link that ~S.O.S.~ supplied :). Between both of these, I will hopefully get some results.

I am trying the Daniweb snippet right now; did not get far: When I run the initial snippet I am told that the py2exe module does not exist. The original, downloaded py2exe file is in my Python working folder with the prepared code snippet saved as .py . I am not sure why it is not being recognized.

Using: py2exe-0.6.5.win32-py2.5, Python 2.4.3 (IDLE)

sharky_machine

Using: py2exe-0.6.5.win32-py2.5, Python 2.4.3 (IDLE)

There's your problem. IDLE was never quite finished. The Run Module in the Run menu doesn't pass any command line arguments that way that other IDEs do. Follow all the steps in tutorial.

:D
Maybe you should just read the link I posted and the original thread.

:D
Maybe you should just read the link I posted and the original thread.

~s.o.s.~

Will do right now.

thanks.
sharky_machine

You should have 2 files, let's say your p2e templet file p2e_test1.py modified with your code filename, and your code file test1.py. Save these 2 files in the same directory and just douple-click on p2e_test1.py

That's really all there is to it!

Otherwise make sure the Python versions match, you seem to be using Python 2.5. I avoid IDLE as an IDE, just too primitive!

You should have 2 files, let's say your p2e templet file p2e_test1.py modified with your code filename, and your code file test1.py. Save these 2 files in the same directory and just douple-click on p2e_test1.py

That's really all there is to it!

Otherwise make sure the Python versions match, you seem to be using Python 2.5. I avoid IDLE as an IDE, just too primitive!

I avoid IDLE also until last night (I always use DrPython to build); for some unexplained reason, after closing DrPython, rebooting my system, and tring to reopen a current project, DrPython would not open :surprised :sad: -- only the flash of a black console... nothing. I panicked for a moment but was too busy to fool with this problem. I opened IDLE and continued. Cannot let myself to be slowed down when I'm in the deep zone of coding and producing well. :cheesy:

I am tring to get this exe file from my program up and running-- I find it a bit confusing. Had no idea it would take so much to produce an exe. I am learning a lot, though, so that's what is important.

Regards,
Matty D.

~s.o.s.~

Will do right now.

thanks.
sharky_machine

I am trying this now via your link; so far my results are as follows:

  • 1 buildHelloWorld directory folder: empty
  • 1 HelloWorld.spec file

I think I am on the right track at least-- something is working here, but no exe file as stated in the tutorial link. When the bat file is run, it flashes for about 1.5-seconds then dissapears. I assume the bat is running up unto a certain point and cannot execute a particular command past this point, then closes.

I am going to look this over and try to figure it out.

sharky_machine

Here a LINK to a screenshot of the cmd window showing bat results.

It seems that the test file HelloWorld.py is not being recognized; it is in the same directory so I do not understand why this is.

I like to use PyInstall for Tkinter files. The result looks a little neater than the Py2exe result. I made up this small help file a while ago ...

Extract the pyinstaller_1.3.zip file into eg. C:\Python24 and rename the new directory to C:\Python24\PyInstaller13\ (to make it easier on the eye).

Now run the Configure.py file found in that folder, this creates a config.dat file that lets PyInstaller know about your version of Python and so on.

Next create a test folder eg. C:\Python24\PyInstaller13\Atest\

Copy a Python file you want to test, let's say Calendar1.py to its own folder
eg. C:\Python24\PyInstaller13\Atest\Calendar1\

Use an editor to create this batch file ...

set PIP=C:\Python24\pyinstaller13\
python %PIP%Makespec.py --onefile --console Calendar1.py
python %PIP%Build.py Calendar1.spec

.. and save it as Calendar1.bat into the same folder with Calendar1.py.

Finally run the batch file, the file Calendar1.exe and a number of smaller temp files will be created. Calendar1.exe is an executable package file that contains all the source bytcode, the needed modules and in this case the Python24.dll Python interpreter.

Here a LINK to a screenshot of the cmd window showing bat results.

It seems that the test file HelloWorld.py is not being recognized; it is in the same directory so I do not understand why this is.

Hmm....you can try this.

Hello:

I have attempted all submitted ideas. None work. I suppose I will have to send my boss all needed files seperately to run this on his laptop: Python 2.5, Tkinter, the program and all build files. I wanted to avoid this and make it simple for him, but I guess this will work. He will just have to run it from IDLE manually when he is Japan. :-|

Can anyone suggest a "prettier" IDE for Python? I have used DrPython only (besides IDLE) but after my recent crash conflicts with DrPython I am leary of ever using it again. :sad:

I really appreciate everyone's help. I am not giving up on making an EXE this week to package my program but I am somewhat confused with what to do. Now when it tries to run, the cmd window reports that "python" is not recognized :surprised :cry: Bizarre.

Regards,
sharky_machine

That seems like an extreme solution. I have no experience with py2exe, or I would offer to help ... but could perhaps one of you experts turn sharky's code into a .exe and send him the file in a private message or something?

Just a thought,
Jeff

Well, I have sucessfully created a Python executable. Very exciting indeed :cheesy: . I followed the tutorial (submitted by ~s.o.s.~); another aspect to this sucessfully being built, I believe, is that I tried doing it on my girlfriend's laptop which is much newer, faster, and stable than my PC. My PC seems to be having some system issues (missing some dll files, memory anomalies) that I cannot rectify at this point. I do not know if this would affect the Python EXE packaging directly, but there have been errors reported lately by various system utilities.

I hope that this works for when I attempt to package the promo for my boss; it will be more complex: Tkinter GUI, image disply, etc.

I am very grateful for everone that made suggestions and offered their help. ;);)

Regards,
Matty D.

Well, I have sucessfully created a Python executable. Very exciting indeed :cheesy: . I followed the tutorial (submitted by ~s.o.s.~); another aspect to this sucessfully being built, I believe, is that I tried doing it on my girlfriend's laptop which is much newer, faster, and stable than my PC. My PC seems to be having some system issues (missing some dll files, memory anomalies) that I cannot rectify at this point. I do not know if this would affect the Python EXE packaging directly, but there have been errors reported lately by various system utilities.

I hope that this works for when I attempt to package the promo for my boss; it will be more complex: Tkinter GUI, image disply, etc.

I am very grateful for everone that made suggestions and offered their help. ;);)

Regards,
Matty D.

**Update:

I just built a second test with pyinstaller, this time of the actual program to send to my boss-- it works; the images and intended display seems to runs perfect, all now packaged neatly into an executable.

The only aspect I must research and find out at this point is the size of the executable's display: It is about 1/3 the size of the original; this is fine really, but I would prefer to have the original size as the application is designed as a visual demo and, hence, it is obviously important that it is seen well.

Thanks again, everyone. I feel as if I've taken a good step in my ability to not only dev Python but to be able to neatly and professionally package and ship work as well. I'm always learning something new on DaniWeb. :cheesy: ;)

Regards,
sharky_machine

Great! You got it to go and learned in the process!

My advice on DrPython, get it to work, there isn't much out there to replace it, unless you go to a commercial IDE like Wing IDE ( http://wingware.com/ ). Relatively inexpensive, and I heard only good things about it. Your boss might spring for it in the software budget.

The DrPython team is still active and just reased DrPython163. Remember that it uses the wxPython GUI, so your Python and wxPython versions have to match. There is also something about the MFC71.DLL on Windows machines, normally there, but yours might be missing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.