py_compile in windows

Alex Martelli aleaxit at yahoo.com
Tue Jan 16 09:03:46 EST 2001


"Brian Waskiewicz" <bwaskiew at indiana.edu> wrote in message
news:93vviq$71b$1 at flotsam.uits.indiana.edu...
> In Windows 98, how do I use py_compile.compile to make a .py file into a
> .pyc file?

Similarly to how you use it in other environments,
e.g., to compile all the files whose names are
passed as script arguments,

import py_compile, sys

for source_name in sys.argv[1:]:
    py_compile.compile(source_name)

you may write this into compileit.py and then
run it, for example:

D:\PySym>python compileit.py wri.py

a file wri.pyc will now appear in the current
directory (assuming wri.py was there & correct:-).


Alex






More information about the Python-list mailing list