**NEWBIE - QUESTION**
jay at jaydorsey.com
Tue Oct 28 18:15:08 CET 2003
Staven Bruce wrote:
> I am new to Python and am trying to use the Python-2.3.2-1Interperter on
> Windows. I have a .py file and I am trying to compile it into a .pyc file.
> When I began experimenting with Python, I could have sworn that opening the
> .py file in IDLE, modifying it, and then saving it would automatically
> create the corresponding .pyc file. But this is not working.
I believe you have to *run* the file to get it to compile, not just save it.
> I have checked the FAQ's and the Python Help pages, but I believe I am
> somewhat dense. If I try to call 'compileall file.py', the syntax is
> invalid. If I try to call 'compile file.py' I also receive a syntax error. I
> know I am missing something rather basic here, but if anyone could
> point/shove me in the right direction I would appreciate it.
This should work as well:
>>> from compileall import py_compile
More information about the Python-list