pythondjangotravis-cipylintsingle-dispatch

Travis pylint build failing with error regarding singledispatch


My Travis build is currently failing at pylint with the error:

Traceback (most recent call last):
  File "/home/travis/virtualenv/python3.3.6/bin/pylint", line 11, in <module>
    sys.exit(run_pylint())
  File "/home/travis/virtualenv/python3.3.6/lib/python3.3/site-packages/pylint/__init__.py", line 17, in run_pylint
    from pylint.lint import Run
  File "/home/travis/virtualenv/python3.3.6/lib/python3.3/site-packages/pylint/lint.py", line 75, in <module>
    import astroid
  File "/home/travis/virtualenv/python3.3.6/lib/python3.3/site-packages/astroid/__init__.py", line 62, in <module>
    from astroid.nodes import *
  File "/home/travis/virtualenv/python3.3.6/lib/python3.3/site-packages/astroid/nodes.py", line 23, in <module>
    from astroid.node_classes import (
  File "/home/travis/virtualenv/python3.3.6/lib/python3.3/site-packages/astroid/node_classes.py", line 34, in <module>
    from functools import singledispatch as _singledispatch
ImportError: cannot import name singledispatch

The build command I am currently using for pylint is:

find -name "*.py" -not -path "*/migrations/*" -not -name "apps.py" -not -name "wsgi.py" -not -name "manage.py" | xargs pylint --load-plugins pylint_django

which works on my local windows machine (in a bash shell). The rest of my build script is:

language: python

python:
        - "3.3"
        - "3.4"
        - "3.5"
        - "3.5-dev"
        - "3.6"
        - "3.6-dev"
        - "3.7-dev"

install:
        - pip install flake8
        - pip install flake8-docstrings
        - pip install pylint
        - pip install pylint-django
        - pip install -r requirements.txt
        - npm install -g stylelint
        - npm install stylelint-config-standard --save-dev
        - npm install -g eslint
        - npm install -g eslint-config-standard eslint-plugin-standard eslint-plugin-promise eslint-plugin-import eslint-plugin-node

script:
        - flake8 . --exclude migrations,tests.py,__init__.py,apps.py,manage.py
        - find -name "*.py" -not -path "*/migrations/*" -not -name "apps.py" -not -name "wsgi.py" -not -name "manage.py" | xargs pylint --load-plugins pylint_django
    - stylelint **/static/**/*.css
    - eslint . --ignore-pattern '/staticfiles/*'

How should I go about fixing this error? Thanks in advance.


Solution

  • Turns out the issue was somehow arising from flake8 interfering with pylint. Swapping their order in the build script fixed the problem