4

I am new to VS Code and I installed e.g. PySide for my tutorial project written in Python. I try to:

from PySide.QtGui import QDialog, QApplication, QVBoxLayout, QLineEdit, QTextBrowser
from PySide.QtCore import *

Although the code runs perfectly well using the imported modules, VS Code complains with:

[pylint] E0401:Unable to import 'PySide.QtGui'

or

[pylint] E0401:Unable to import 'PySide.QtCore'

This is very irritating, since I am able to use the modules as expected. I would guess an configuration issue, but do not know how to fix this.

Thank you very much.

See also:

Visual representation of VS Code complaining

EDIT:

I use a precompiled version of PySide. Could this be the reason for this behaviour?

Andreas
  • 307
  • 3
  • 14

3 Answers3

2

@Andreas Schwab, You need to ensure pylint is installed in the python environment in which you have installed the PySide package. You will also need to ensure this same environment (python interpreter) is referenced in settings.json in the python.pythonPath setting.

You can find more details on these two here:

Don
  • 6,632
  • 3
  • 26
  • 34
  • Unfortunately, the solution provided here: https://github.com/DonJayamanne/pythonVSCode/wiki/Troubleshooting-Linting#1-unable-to-import--pylint did not work. I have not setup a virtual environment, yet. – Andreas Sep 15 '16 at 19:05
  • Andreas Schwab, please could you raise an issue for this on GitHub. It would be easier to resolve it there as we can share more information such as screen dumps and the like. E.g. sharing your launch.json and settings.json, etc – Don Sep 16 '16 at 00:43
0

With the update 1.6 of Visual Studio Code and corresponding Python extension, the problem does not appear anymore.

Andreas
  • 307
  • 3
  • 14
0

Ensure that you have installed pylint in your environment (virtual env in case)

pip install pylint
JDP
  • 385
  • 3
  • 7