Search code examples
pythonmacospylint

Pylint AttributeError: 'module' object has no attribute 'append'


I was configuring my new laptop (macbook pro) and everything was fine until I wanted to try my pylint command.

Traceback (most recent call last):
  File "/usr/local/bin/pylint", line 11, in <module>
    load_entry_point('pylint==1.6.4', 'console_scripts', 'pylint')()
  File "/usr/local/lib/python2.7/site-packages/pylint-1.6.4-py2.7.egg/pylint/__init__.py", line 13, in run_pylint
    Run(sys.argv[1:])
  File "/usr/local/lib/python2.7/site-packages/pylint-1.6.4-py2.7.egg/pylint/lint.py", line 1270, in __init__
    'init-hook')))
  File "/usr/local/lib/python2.7/site-packages/pylint-1.6.4-py2.7.egg/pylint/lint.py", line 1371, in cb_init_hook
    exec(value) # pylint: disable=exec-used
  File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 'append'

From that I don't understand what's wrong with my pylint .... I tried a lot of things but as I'm not quite sure of what I've done at the end, I prefer to not list things.

Is there someone who already got it ? Someone who have an idea how to solve it?

Thanks for your help


Solution

  • Hi, can you show the value of init-hook from the configuration file you are using? What happen is that you have configured, somehow, init-hook with some invalid code. You can see this in your traceback through the last exec call, which happens only when init-hook is provided. Seeing its value could lead to solving this problem. My intuition is that you probably have something as in ``init-hook="import sys; sys.append(some_path)"

    Thanks to PCManticore, that was that, I had a .pylintrc in my home folder that had something weard for the init-hook value. I changed that and everything is working well now.