Re: Need help: Compiling Python-Code

Discussion in 'Python' started by Thomas Buschhardt, Jul 15, 2003.

  1. import py_compile
    pycompile.compile(Python-file)

    Bye Thomas
     
    Thomas Buschhardt, Jul 15, 2003
    #1
    1. Advertising

  2. "Thomas Buschhardt" <> wrote in message news:<>...
    > import py_compile
    > pycompile.compile(Python-file)
    >
    > Bye Thomas


    I am sure the OP has a good reason for asking his question,
    nevertheless for the sake of newbies who wonder if they should
    byte-compile their scripts, here is an extract from help(py_compile):

    Note that it isn't necessary to byte-compile Python modules for
    execution efficiency -- Python itself byte-compiles a module when
    it is loaded, and if it can, writes out the bytecode to the
    corresponding .pyc (or .pyo) file.

    However, if a Python installation is shared between users, it is a
    good idea to byte-compile all modules upon installation, since
    other users may not be able to write in the source directories,
    and thus they won't be able to write the .pyc/.pyo file, and then
    they would be byte-compiling every module each time it is loaded.
    This can slow down program start-up considerably.


    Just my 2 cents,


    Michele
     
    Michele Simionato, Jul 15, 2003
    #2
    1. Advertising

  3. > import py_compile
    > py_compile.compile(Python-file)


    That's it. Thx!
    Now I can compile my complex capisuite-incoming/idle-scripts.

    Carsten
     
    Carsten Heesch, Jul 15, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Carsten Heesch

    Need help: Compiling Python-Code

    Carsten Heesch, Jul 15, 2003, in forum: Python
    Replies:
    0
    Views:
    304
    Carsten Heesch
    Jul 15, 2003
  2. Replies:
    2
    Views:
    656
    Jack Klein
    Aug 19, 2006
  3. CRAIG DALTON
    Replies:
    1
    Views:
    226
    Gabriel Genellina
    May 2, 2008
  4. Garrett Cooper
    Replies:
    0
    Views:
    589
    Garrett Cooper
    Feb 24, 2009
  5. Garrett Cooper
    Replies:
    0
    Views:
    522
    Garrett Cooper
    Feb 24, 2009
Loading...

Share This Page