1

I started running into an import issue where PyCharm is unable to resolve references to classes for some libraries I have installed. I haven't run into this issue for any standard libraries.

from cerberus import Validator used to work but stopped working along with the other reference issues.

I have tried:

  1. File > Invalidate Caches / Restart
  2. Using a difference Anaconda env
  3. Re-installing library
bad_coder
  • 11,289
  • 20
  • 44
  • 72
Kenton Parton
  • 70
  • 1
  • 5
  • ctrl + click on `cerberus`, do you see that class in the opened file ? – S.B Jul 04 '21 at 20:18
  • @SorousHBakhtiary when I ctrl + click I go into cerberus/__init_.py and the Validator class is present like so: `from cerberus.validator import DocumentError, Validator` – Kenton Parton Jul 04 '21 at 20:24
  • Does the `__init__.py` have syntax highlighting? Btw which PyCharm version do you use? – Pavel Karateev Jul 05 '21 at 15:41
  • @PavelKarateev `__init__.py` does not have syntax highlighting. I am using PyCharm version 2021.1.3 – Kenton Parton Jul 05 '21 at 16:05
  • 1
    @PavelKarateev I went to Preferences > Editor > File Type. I thought __init__.py would be under "Text" but it wasn't. I then added "__init__.py" to the Python file type under the "Recognized File Types" tab. This solved the issue. Thank you. – Kenton Parton Jul 05 '21 at 16:55

0 Answers0