Page 1 of 3 123 Last
  • Jump to page:
    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    12
    Rep Power
    0

    How to convert .py to .exe?


    I installed python and py2exe.How can I use py2exe to convert py file to exe file?Thank you.
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,592
    Rep Power
    4207
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    12
    Rep Power
    0
    Thanks.A question:What should I put "python setup.py py2exe"?Inside the code?
  6. #4
  7. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,592
    Rep Power
    4207
    No, you run that from the command line.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    12
    Rep Power
    0
    run from Python command?
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Location
    Tucson AZ
    Posts
    29
    Rep Power
    0
    from the command line you would type:
    "python setup.py py2exe"

    This will launch setup.py, setup.py will tell py2exe which python file you want to convert to an exe
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    12
    Rep Power
    0
    I saved my work at D:\abc1\abc1\, then i tried to type "c:\python23\python.exe d:\abc1\abc1\setup.py py2exe".The program I made run,but in the command-line,there are some lines said:

    running py2exe
    running build
    running build_scripts
    error file 'abc.py' does not exist.


    Also,I couldn't find the .exe file.

    This is my seutp.py file:


    # setup.py
    from distutils.core import setup
    import py2exe

    setup(name="abc",
    scripts=["abc.py"],
    )



    Thanks a lot.
  14. #8
  15. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,592
    Rep Power
    4207
    Do you actually have a file called abc.py somewhere or did you just make that up?
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  16. #9
  17. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    12
    Rep Power
    0
    i have the abc.py file which is in the same folder as setup.py.that's why i am confused about it.

    Is my command right?
  18. #10
  19. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,592
    Rep Power
    4207
    Ok, then do this instead.
    1. Go to the dos command prompt. This can be done by going to Start-->Run... and typing "cmd" (or "command" for Windoze 98) and then hitting enter.

    2. On the DOS window, type the following:
    d:
    cd \abc1\abc1
    c:\python23\python.exe setup.py py2exe

    See if that helps you.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  20. #11
  21. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    12
    Rep Power
    0
    Thank you so much.It looks working.After I run the command you gave me,there are so many lines coming out.it seems to add some news files in my abc\abc folder.Also,a new folder has been created : dist\abc\.some files like python23.dll and abc.exe are there.Does it mean py2exe successfully?


    Thanks a lot.
  22. #12
  23. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,592
    Rep Power
    4207
    If you didn't see any error messages, then it must have been successful
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  24. #13
  25. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    12
    Rep Power
    0
    Thank you.Wow!This is the first time I did py2exe.What I did before is run the command under C:,not in my program's folder.Now I understand it.
  26. #14
  27. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    12
    Rep Power
    0
    I also have a question: when I run the program that I made,the DOS windows always comes out.How can I remove it?
  28. #15
  29. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    There are two ways that i know of to do this, 1 you could us the -w flag from the command line, something like..

    python setup.py py2exe -w

    2, give your python program a .pyw extension (abc.py becomes abc.pyw)

    Mark.
    programming language development: www.netytan.com Hula

Page 1 of 3 123 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo