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

    Join Date
    Feb 2004
    Posts
    30
    Rep Power
    11

    My python editor comes with a compiler but I don't know how to use the compiler??!!??


    I am using Python 2.2.3 that I got from a friend. Now the tutorial says some thing about having to have a command in the command line that will compile it well i have tryed anything I can but it still won't work. I want to compile this neat program I made and it just won't compile.
  2. #2
  3. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Being an interpreted language Python programs don't need to be compiled to run. So If you want to run a the Python program then fire up you're command line and...

    Code:
    Microsoft Windows XP [Version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.
    
    C:\Documents and Settings\Mark>cd c:\python
    
    C:\Python>python path\to\python\program.py
    ...
    ...
    Note: this example was taken from Microsoft Windows XP but the consept is the same on *nix . On Windows you can also run Python programs by double clicking on the file you want to run.

    You might also be interested in upgrading you're Python version to the latest version (2.3.3). You can find this and much more at:

    http://www.python.org/

    Hope this has helped clear things up for you,

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

  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    30
    Rep Power
    11
    Well I know how to run the program it is just i am not entirely sure on how to compile it with Python interperter 2.2.3.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    133
    Rep Power
    12
    You don't compile it.
  8. #5
  9. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    13
    When you run the "program.py" file Python automatically
    compiles the text to bytecode and store it in memory. It is the bytecode that is actually run by Python. If your program imports another file then this file is also converted to bytecode but the bytecode is stored in .pyc files.

    Bytecode is like a halfway house between plain text and real machine code.

    To make a stand alone program .exe file you need other tools like py2exe and installer. But these are only needed if you plan to send your program to friends who do not have Python installed Even these .exe programs still run the bytecode! It is just that they bundle Python and the bytecode into one big file.
    Cheers,
    Grim
    Last edited by Grim Archon; February 26th, 2004 at 05:52 AM. Reason: removed stupid error!

IMN logo majestic logo threadwatch logo seochat tools logo