Reputation: 531
It is all fine until I create new python3.7.7 virtualenv
and I notice that init.py is different from before.
Upvotes: 0
Views: 36
Reputation: 531
Oh...my fault...
File--->Settings--->Editor--->File Types ---> find Text ---> delete init.py
I really don't when and how I modified the config.
Upvotes: 1
Reputation: 3855
There are several reasons why this could be happening. Below are several steps that fixes the majority of those cases:
.idea caching issue
Some .idea
issue causing the IDE to show error while the code still runs correctly. Solution:
.idea
folder where the project is. note that it is a hidden folder and you might not be aware of its existence in your project directory.imports relative not to project folder
Relative imports while code root folder is not the same as the project folder. Solution:
Editor not marking init.py as Python
Which is the most illusive of all the cases. Here, for some reason, PyCharm considers all init.py files not to be python files, and thus ignores them during code analysis. To fix this:
Upvotes: 0