Installation and Pylint error

Installation and Pylint error

von Jon Witts -
Anzahl Antworten: 2

Hi there,

I have followed teh install guide and installed jobe on a Ubuntu 18.04 server; however when I get to the pylint install / configuration section I am faced with the following issue:

sudo -H python3 -m pip install pylint

returns:

Requirement already satisfied: pylint in /usr/lib/python3/dist-packages

However then running the following:

sudo -i
pylint --reports=no --score=n --generate-rcfile > /etc/pylintrc

returns:

Command 'pylint' not found, but can be installed with:

apt install pylint

What do I need to do to get pylint to work on the command line?

Thanks,

Jon

Als Antwort auf Jon Witts

Re: Installation and Pylint error

von Richard Lobb -

Those commands work for me, so it sounds like your Ubuntu 18.04 is configured differently, somehow. So ... some experimenting is called for. Some things to try:

  • The pylint install should have created a file /usr/local/bin/pylint containing the following code:

    #!/usr/local/bin/python3.9 # -*- coding: utf-8 -*- import re import sys from pylint import run_pylint if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) sys.exit(run_pylint())
    If that's there then it seems your PATH environment variable isn't set to include /usr/local/bin. You could either fix the PATH to include it or symlink to that script from somewhere that is on the PATH. If instead that script isn't there you could create it.
  • apt install pylint may work, but the problem that used to occur with that is that when you ran the pylint command you got python2 checking, not python3. So try it and then try checking some python2 code, e.g. print "Hi" and make sure it gets rejected. If not, uninstall and continue.
  • apt install pylint3 used to work, but that gave you a command pylint3 not a command pylint. If that works, you could symlink pylint to pylint3.
  • Your current install of pylint can be run with a command like

    python3 -m pylint  argument1 argument2 ...
    so you could if you wanted run the pylintrc install command that way. But the command pylint won't work in that case and you'll have to change any use of raw pylint commands in the tester and question types to python3 - m pylint
Als Antwort auf Richard Lobb

Re: Installation and Pylint error

von Jon Witts -
Thanks...

I had nothing in /usr/local/bin at all so I created the pylint file as you suggested. On first run it failed as I don't have python in /usr/local/bin either...

Updated the pylint script to:

#!/usr/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
from pylint import run_pylint
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(run_pylint())

run chmod +x /usr/local/bin/pylint and all seems to be well now.

Thanks :-)