Something like Perl's -c flag?

Magnus Lie Hetland mlh at idi.ntnu.no
Sat Sep 1 18:33:49 EDT 2001


"Oleg Broytmann" <phd at phd.pp.ru> wrote in message
news:mailman.999326826.29300.python-list at python.org...
> 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
(pychecker.sf.net)

> Oleg.
> ----
>      Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
>            Programmers don't die, they just GOSUB without RETURN.

--

  Magnus Lie Hetland         http://www.hetland.org

 "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