leinardi / pylint-pycharm

A plugin providing both real-time and on-demand scanning of Python files with PyLint from within PyCharm/IDEA.
Apache License 2.0
196 stars 35 forks source link

Plugin Doesn't Use Interpreter's PYTHONPATH #90

Open JonnoFTW opened 2 years ago

JonnoFTW commented 2 years ago

Step 1: Are you in the right place?

Step 2: Describe your environment

Step 3: Describe the problem:

Pylint plugin does not set PYTHONATH when running pylint. import-error will be returned for lines that would normally work because they are set in the project interpreter's custom PYTHONPATH. A typical use case is when I am using a git submodule and want to import code from it.

The plugin also does not give a way to manually pass environment variables to the pylint call

Steps to reproduce:

  1. Include code in subdirectory of project, eg. lib
  2. Add lib to pythonpath of interpreter: File -> Settings -> Project -> Python Interpreter -> Cog Icon -> Show All -> Show Paths (last icon in the top bar) -> + Icon -> Select Path of lib. Save settings
  3. Run pylint plugin
  4. You will get import errors for modules in lib

Observed Results:

image

image

Expected Results: