1

I use VS Code to write and test python scripts.

Is it possible to make the editor aware of imported modules

to avoid problems listed like

Module 'numpy' has no 'divmod' member

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Erhy
  • 92
  • 3
  • 8

1 Answers1

1

You would update the Python interpreter settings according to where modules have been installed. (bottom right of VS Code)

The IDE being used isn't really relevant because you could invoke /path/to/bin/python, start a REPL, import the same module, and get the same error


Regarding, "numpy has no ... member", based on searching, that is a PyLint issue, not an import issue

How do I get PyLint to recognize numpy members?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • now I followed the advice in dev.to/ldsands/the-best-linter-for-black-in-vs-code-54a0 . Levi Sands means, it is the best to use the linter flake8 and to add lines in settings – Erhy 13 mins ago – Erhy Oct 10 '20 at 14:48
  • now, no problems are listed, but I don't know about the ignore arguments e.g. "--ignore=E203" – Erhy Oct 12 '20 at 12:38
  • flake8args https://stackoverflow.com/a/62317424/2308683 – OneCricketeer Oct 12 '20 at 12:59
  • thank you for the link. I inserted the line-length from the example. – Erhy Oct 14 '20 at 12:18