Hi Derek,

Thanks a lot.

On 08/11/2011 12:28 AM, Derek Harland wrote:
> On 11/08/2011, at 10:16 , Gelonida N wrote:

>>
>> Now I try to change it to use pylint.lint.Run()
>> y first test was just performing multiple runs without even trying to
>> capture the outpout
>>
>> from pylint import lint
>> for filename in filenames:
>>      args = [ '-f',  "text", pm_file)
>>        lint.Run(args) # first attempt without capturing output
>>
>> However it seems, that Run exits immediately after the first linting
>> process.
> 
> Always a good idea to either check the source when you have it ... or at the 
> very least use pydoc ...
> 

In fact I used pydoc, but unfortunately I used it in the wrong window
(with my distros version of pylint which is only pylint 0.19.0)


There pydoc gave me:
> lass Run
> |  helper class to use as main for pylint :
> |  
> |  run(*sys.argv[1:])
> |  
> |  Methods defined here:
> |  
> |  __init__(self, args, reporter=None)

So the argument exit did not exist there. that's why I posted the question.

Additionally it might have helped of course if the official web site
(being marked as updated 8th of August 2011) had not mentioned a command
(pylint.lint.run_py), that I couldn't find


Running pydoc in the correct window (virtualenv) gives of course the
information, that I was looking for.

> $ pydoc pylint.lint.Run
> Help on class Run in pylint.lint:
> 
> pylint.lint.Run = class Run
>  |  helper class to use as main for pylint :
>  |  
>  |  run(*sys.argv[1:])
>  |  
>  |  Methods defined here:
>  |  
>  |  __init__(self, args, reporter=None, exit=True)
> 



Will now have to check, whether there's an elegant way to redirect the
reports output into a string.

Basically the equivalent of:
> from pylint import lint
> (pylint_stdout, pylint_stderr) = lint.py_run( 'module_name.py', True)

Non elegant work around might be to redirect stdout / stderr before
pylint.lint.Run.__init__() is executed


Thanks again




.


_______________________________________________
Python-Projects mailing list
[email protected]
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to