Get Pylint to work with Python 3 programs

Here’s my note on getting Pylint to work with Python3. The issue is that I also have Python2.7 installed on the machine. As a result, when I just run “pylint python3_program_name.py”, the script gives “invalid syntax” errors.

One trick I did was to use the following command instead

python3 -m pylint python3_program_name.py

This seems to triggers the pylint for Python3 as it executes the pylint with python3. The “-m” option runs library modules as a script.

I got the hint from this post here (https://www.reddit.com/r/learnpython/comments/822qsc/running_pylint_for_python3/).

I also just realized that pylint is also doing static code analysis and can detect many errors statically like a compiler, which is very cool!

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s