Something like Perl's -c flag?

Magnus Lie Hetland mlh at
Sun Sep 2 00:33:49 CEST 2001

"Oleg Broytmann" <phd at> wrote in message
news:mailman.999326826.29300.python-list at
> On 31 Aug 2001, Mark Atwood wrote:
> MA> Does the Python interpreter have anything like Perl's -c flag, which
> MA> does a static syntax and sanity check without actually running the
> MA> script?
>    Just compile the script. Like this:
> import sys
> from py_compile import compile
> if len(sys.argv) <= 1:
>    sys.exit(1)
> for file in sys.argv[1:]:
>    compile(file)

You could also use pythonc, of course. Or, better yet, Pychecker

> Oleg.
> ----
>      Oleg Broytmann              phd at
>            Programmers don't die, they just GOSUB without RETURN.


  Magnus Lie Hetland

 "Reality is that which, when you stop believing in
  it, doesn't go away."           -- Philip K. Dick

More information about the Python-list mailing list