Find more than one error at once

John Machin sjmachin at lexicon.net
Sat May 10 19:42:06 EDT 2008


Diez B. Roggisch wrote:
> Joseph Turian schrieb:
>> Is it possible to coax python to find more than one error at once?
> 
> What kind of errors? Syntax-errors? Then use one of the python source 
> code analyzers, such as pylint or pychecker.

I don't know about pylint, but "PyChecker works in a combination of 
ways. First, it imports each module. If there is an import error, the 
module cannot be processed." -- so it fails on the first syntax error. 
For example:

C:\junk>type syntaxerrors.py
if foo = bar:
     pass
foo = "unterminated
123 = foo

C:\junk>python -m pychecker.checker syntaxerrors.py
Processing syntaxerrors...
   SyntaxError: invalid syntax (syntaxerrors.py, line 1)
     if foo = bar:
            ^

Warnings...

syntaxerrors:1: NOT PROCESSED UNABLE TO IMPORT

C:\junk>





More information about the Python-list mailing list