Thread: Wierd

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2005
    Posts
    54
    Rep Power
    11

    Wierd


    So last night i got Python downloaded on my comp, and i was all excited to start learning. I read the first few sections of the docs they have on the python site, and got slowly more and more confused. Here is the thing...im starting to get a grasp on how the language works and what you can do in it but im still not sure how you would go about compiling an executable in python...this is a very noobish question i know, but im just confused right now. Any help would be really appreciated.
  2. #2
  3. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Dec 2004
    Location
    Meriden, Connecticut
    Posts
    1,797
    Rep Power
    154
    Actually the question isn't noobish. You need a compiler to make windows executables out of your Python programs. For windows, I would suggest using py2exe. You can find the main site through a quick search in google. I think the post at the top of this section as a link to a small tutorial on how to use py2exe. It's very easy to use, and very useful distributing your Python programs.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2005
    Posts
    54
    Rep Power
    11
    Ok thanks, is there any way to program for multiple OS's? Id like to make Windows, Mac, and Linux compatible programs in an ideal world...
  6. #4
  7. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Dec 2004
    Location
    Meriden, Connecticut
    Posts
    1,797
    Rep Power
    154
    Yes. py2app is made for making executable applications for Mac. I'm pretty sure there is one for Linux, however I don't know the name. Try searching google for python linux executable.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Location
    Bimingham,AL
    Posts
    68
    Rep Power
    11
    http://forums.devshed.com/showthread...16#post1025816

    you might want to look at the above thread
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2005
    Posts
    54
    Rep Power
    11
    Yay, i got it up and working. Just succesfully compiled and ran a hello world program! Go me!
  12. #7
  13. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Dec 2004
    Location
    Meriden, Connecticut
    Posts
    1,797
    Rep Power
    154
    Heh, congratulations.
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Posts
    624
    Rep Power
    35
    Originally Posted by Max Dismukes
    So last night i got Python downloaded on my comp, and i was all excited to start learning. I read the first few sections of the docs they have on the python site, and got slowly more and more confused. Here is the thing...im starting to get a grasp on how the language works and what you can do in it but im still not sure how you would go about compiling an executable in python...this is a very noobish question i know, but im just confused right now. Any help would be really appreciated.
    It is a noobish question; noobs always seem ask how to make exe's...

    Well, typically, you don't. Building EXEs is a red herring brought from other languages that require it. Not needed and cumbersome, mostly. See:

    Ok thanks, is there any way to program for multiple OS's?
    That's how Python is cross-platform compatible and fast to develop in - because you never need to go through a compile/build stage, and it never targets a particular OS. It just targets Python. Have Python installed on your linux box? Just copy the .py file over and run it. Same with the Mac. Same with the PocketPC, and in the future (hopefully) same with IronPython.

    Yes, this does mean you need to have Python installed to run programs, and if you have written a program that you wish to distribute, /then/ start looking for py2exe as a last step. But not until then, as it will only get in the way most of the time and is, for your normal use (as you have Python), completely unnecessary.

    Just double-click on a .py file and it will run. Or rename it to .pyw if you want it to run without the DOS window visible. Or start it from the command line, as if it was any other program. Or make a shortcut to it.

    Last edited by sfb; April 13th, 2005 at 06:22 PM.
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2004
    Location
    There where the rabbits jump
    Posts
    556
    Rep Power
    12
    Don't be mean sfb(does it matter)

    Anyway you could also just keep the scripts in .py or whatever and have the python installd on the computer
  18. #10
  19. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Posts
    624
    Rep Power
    35
    Originally Posted by monkeyman23555
    Don't be mean sfb
    I wasn't being mean; that's proper friendly sales talk, that is.

    It just happens that it is a noobish question. That doesn't have to be taken as an insult, however, just an observation. Check the forum history and newsgroups, if you look in the same places I have, you see that "How do I make EXEs" is said mostly by people new to Python.

    I'd say it's far meaner to act as if Py2EXE is a typical everyday thing used to write Python software when in fact it's a separate module used occasionally when a project is done, dusted, and someone you can't convince has complained about needing Python.

    It adds significantly to development effort, program complexity, filesize and time. I suggest (quite strongly) that you not bother with it until you need to.
    Last edited by sfb; April 14th, 2005 at 01:28 PM.
  20. #11
  21. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2004
    Location
    There where the rabbits jump
    Posts
    556
    Rep Power
    12
    Ya whatever you say I was a noob one day and you too so... Guess he could be much better then you in 10 years
  22. #12
  23. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Dec 2004
    Location
    Meriden, Connecticut
    Posts
    1,797
    Rep Power
    154
    He may not be programming [Python] in 10 years from now. I hope to stay with Python forever, it is by far my most favorite language.

IMN logo majestic logo threadwatch logo seochat tools logo