syntax checker in python

Jonathan Gardner jgardner at
Fri Aug 7 23:48:51 CEST 2009

On Aug 7, 1:39 pm, horos11 <horo... at> wrote:
> ps - I just realized that it isn't enough to do:
> python -c 'import /path/to/script'
> since that actually executes any statement inside of the script
> (wheras all I want to do is check syntax)
> So - let me reprhase that - exactly how can you do a syntax check in
> python? Something like perl's -c:
>      perl -c script_name.p

You may want to read the sections under "Python Language Services" in
the Python Library Reference. There may be something you are looking
for there.

More information about the Python-list mailing list