Newbie edit/compile/run cycle question

Jan Claeys usenet at janc.be
Sun Dec 9 21:50:24 EST 2007


Op Sun, 09 Dec 2007 01:11:28 +0000, schreef Jeremy C B Nicoll:

> What command (in XP) does one need to issue to syntax check a saved
> python script without running it?
> 
> Does a syntax check report all syntax errors or just the first one
> found?

python -c "import py_compile; py_compile.compile(r'FILENAME')"

... where FILENAME is the filename of the python script you want to check.

What this does in practice is (trying to) compile the source, and any 
errors or warnings will be reported.


-- 
JanC



More information about the Python-list mailing list