November 9th, 2004, 08:12 PM
Help with py2exe!!!!!!
HI everyone i just started with python and install py2exe and did some search for threats on on it and how to used it. BUt i still dont understand how to make your script in a .exe
I need help im only 15 but lookin to advance in python
I need someone to give the easy step by step proccess to i can learn.
I found steps on this site and other but stll dont get it. i get errors
Thanks ya help guys
November 10th, 2004, 08:18 PM
First make sure the program runs without using py2exe
If it does then post both your program and the setup script you are using plus the error reports you get to this forum.
Until we know what scripts you use and the errors you get we cant help!
November 11th, 2004, 09:10 AM
my program is a simple electronics app
here the script
# THE OHM LAW
print " Find voltage"
print " E=I*R"
current=input("What is your current;")
resistance=input("what is your resistance:")
from here i dont know what to do ......i know u have to make a setup script and then add a module that will build it i dont know . Can you help me pls i dont know what to do ,, i got a setup script the is a example here it is
from distutils.core import setup
# The first three parameters are not required, if at least a
# 'version' is given, then a versioninfo resource is built from
# them and added to the executables.
version = "0.5.0",
description = "py2exe sample script",
name = "py2exe samples",
# targets to build
console = ["Ohms Law.py"]
I change the console to my script , but wen i run iit give me this
Traceback (most recent call last):
File "D:\Python24\Lib\site-packages\py2exe\samples\simple\setup.py", line 33, in -toplevel-
console = ["Ohms Law.py"],
File "D:\Python24\lib\distutils\core.py", line 137, in setup
raise SystemExit, gen_usage(dist.script_name) + "\nerror: %s" % msg
SystemExit: usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: no commands supplied
Thanks for your help
November 11th, 2004, 10:51 AM
Please read the sticky messages about posting code to the forum.
To run the setup.py script you posted (assuming it is complete on your machine - it isn't in your post) you must type:
c:\python23\python setup.py py2exe
This is why your code did not compile - setup is complaining that you did not supply it with a command
I notice your program has a space in the file name - this is not good practice. I recommend you rename it to something like ohms_law.py. That way you don't have to know how the OS or a python module that processes the path will handle spaces.
There is no need to use py2exe at all:
November 11th, 2004, 11:14 AM
sorry, but i m still havin problems,im confuse. do paste the setup script in my program in the end or at the beginning?or if not what do i have to do, im a rookie at this....can u show me and example and fix my app so i can turn it in a win32app..i need an example so i can learn.
or can u give a step by step instructions pls.
November 11th, 2004, 02:37 PM
I was trying to figure this one out too and found some sample setup.py scripts that worked for me. I was using Boa Constructor so in the editor window I had to set my comandline parameters, go to File, Set Commandline Parameters and put py2exe in the text box and run your setup.py file.
Mine looked like this:
My setup.py file was in the same directory as the file I was working on. I changed the name to reflect your file.
from distutils.core import setup
Hope this helps.
November 11th, 2004, 05:31 PM
Lets see what we can do here; what I've done is attached a zip archive containing a take off of your Ohms Law program and the setup file used to create the exe .
Thats it; open the ./dist directory and run ohms.exe - it's really pretty simple, if you read the comments in setup.py I'm sure you'll get it .
November 11th, 2004, 08:16 PM
Finally is WORK!!!!!!!wow nice work
but i got one question. Why did you re edited my script. Cuase now i really dont understand and the new stuff that u added jajajaa . Is is neccesary for my future program or can i make program the way i made it the first teim?
Thanks in advance
November 12th, 2004, 01:24 AM
Mark has provided a simple and complete solution for you. Every command is in Python's documentation and will not take you long to look up and read.
Study his solution and you will be able to answer your own question. Play with the code, make some minor changes and understand what happens.
If you are really confused after studying and experimenting then ask about specific lines.
November 12th, 2004, 07:44 PM
Thanks guys for all your help, im finally gettin this and making other simple work