pylint traceback AttributeError: 'NoneType' object has no attribute 'scope'

With this test script: % cat test_util.py #!/usr/bin/env python """Some docstring""" import sys if __name__ == '__main__': """Another docstring.""" pass pylint throws this traceback: % pylint --rcfile=/dev/null test_util.py Traceback (most recent call last): File "/projects/sierra/linux_rh6/install/Python/2.7/bin/pylint", line 9, in <module> load_entry_point('pylint==1.3.0', 'console_scripts', 'pylint')() File "/projects/sierra/linux_rh6/install/Python/2.7/lib/python2.7/site-packages/pylint-1.3.0-py2.7.egg/pylint/__init__.py", line 21, in run_pylint Run(sys.argv[1:]) File "/projects/sierra/linux_rh6/install/Python/2.7/lib/python2.7/site-packages/pylint-1.3.0-py2.7.egg/pylint/lint.py", line 991, in __init__ linter.check(args) File "/projects/sierra/linux_rh6/install/Python/2.7/lib/python2.7/site-packages/pylint-1.3.0-py2.7.egg/pylint/lint.py", line 585, in check self.check_astroid_module(astroid, walker, rawcheckers, tokencheckers) File "/projects/sierra/linux_rh6/install/Python/2.7/lib/python2.7/site-packages/pylint-1.3.0-py2.7.egg/pylint/lint.py", line 662, in check_astroid_module walker.walk(astroid) File "/projects/sierra/linux_rh6/install/Python/2.7/lib/python2.7/site-packages/pylint-1.3.0-py2.7.egg/pylint/utils.py", line 804, in walk self.walk(child) File "/projects/sierra/linux_rh6/install/Python/2.7/lib/python2.7/site-packages/pylint-1.3.0-py2.7.egg/pylint/utils.py", line 804, in walk self.walk(child) File "/projects/sierra/linux_rh6/install/Python/2.7/lib/python2.7/site-packages/pylint-1.3.0-py2.7.egg/pylint/utils.py", line 801, in walk cb(astroid) File "/projects/sierra/linux_rh6/install/Python/2.7/lib/python2.7/site-packages/pylint-1.3.0-py2.7.egg/pylint/checkers/base.py", line 558, in visit_discard if (sibling.scope() is scope and AttributeError: 'NoneType' object has no attribute 'scope' Removing the second docstring (see below) resolves this error: % cat test_util.py #!/usr/bin/env python """Some docstring""" import sys if __name__ == '__main__': # """Another docstring.""" pass -- ---------------- Mark E. Hamilton Engineering Sciences Center Senior Member of Technical Staff Sandia National Laboratories 505-844-7666

On Tue, Aug 19, 2014 at 7:10 PM, Mark E. Hamilton <mhamilt@sandia.gov> wrote:
With this test script:
% cat test_util.py #!/usr/bin/env python """Some docstring""" import sys if __name__ == '__main__': """Another docstring.""" pass
pylint throws this traceback:
% pylint --rcfile=/dev/null test_util.py Traceback (most recent call last): File "/projects/sierra/linux_rh6/install/Python/2.7/bin/pylint", line 9, in <module> load_entry_point('pylint==1.3.0', 'console_scripts', 'pylint')() File "/projects/sierra/linux_rh6/install/Python/2.7/lib/python2.7/site-packages/pylint-1.3.0-py2.7.egg/pylint/__init__.py", line 21, in run_pylint Run(sys.argv[1:]) File "/projects/sierra/linux_rh6/install/Python/2.7/lib/python2.7/site-packages/pylint-1.3.0-py2.7.egg/pylint/lint.py", line 991, in __init__ linter.check(args) File "/projects/sierra/linux_rh6/install/Python/2.7/lib/python2.7/site-packages/pylint-1.3.0-py2.7.egg/pylint/lint.py", line 585, in check self.check_astroid_module(astroid, walker, rawcheckers, tokencheckers) File "/projects/sierra/linux_rh6/install/Python/2.7/lib/python2.7/site-packages/pylint-1.3.0-py2.7.egg/pylint/lint.py", line 662, in check_astroid_module walker.walk(astroid) File "/projects/sierra/linux_rh6/install/Python/2.7/lib/python2.7/site-packages/pylint-1.3.0-py2.7.egg/pylint/utils.py", line 804, in walk self.walk(child) File "/projects/sierra/linux_rh6/install/Python/2.7/lib/python2.7/site-packages/pylint-1.3.0-py2.7.egg/pylint/utils.py", line 804, in walk self.walk(child) File "/projects/sierra/linux_rh6/install/Python/2.7/lib/python2.7/site-packages/pylint-1.3.0-py2.7.egg/pylint/utils.py", line 801, in walk cb(astroid) File "/projects/sierra/linux_rh6/install/Python/2.7/lib/python2.7/site-packages/pylint-1.3.0-py2.7.egg/pylint/checkers/base.py", line 558, in visit_discard if (sibling.scope() is scope and AttributeError: 'NoneType' object has no attribute 'scope'
Removing the second docstring (see below) resolves this error:
% cat test_util.py #!/usr/bin/env python """Some docstring""" import sys if __name__ == '__main__': # """Another docstring.""" pass
Hi, Mark. Which version of astroid? I'm unable to replicate this using the latest. Also, for these type of crashes, it's best to report them on our bug tracker. Thanks.

Claudiu, On 08/19/14 11:47, Claudiu Popa wrote:
Hi, Mark.
Which version of astroid? I'm unable to replicate this using the latest. Also, for these type of crashes, it's best to report them on our bug tracker. Thanks.
Sorry, I should have included that information: % pylint --rcfile=/dev/null --version pylint 1.3.0, astroid 1.2.0, common 0.61.0 Python 2.7.4 (default, Aug 26 2013, 10:48:13) [GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] I will be happy to report it to the bug tracker; I just wasn't sure if a user could do so. -- ---------------- Mark E. Hamilton Engineering Sciences Center Senior Member of Technical Staff Sandia National Laboratories 505-844-7666
participants (2)
-
Claudiu Popa
-
Mark E. Hamilton