Search code examples
pythonlayoutpycharmproject

PyCharm shows wrong project layout after update


Today after an update to PyCharm 2021.2.2 I found that some projects in my workspace were messed up, for example I see this:

enter image description here

Instead of this, that I was seeing before PyCharm update:

enter image description here

Is there any way to fix this?


Solution

  • (Answering my own question so as to save time for users facing the same issue.)

    EDIT: found a more stable and faster solution.

    In PyCharm > Settings > Project Structure, select the project and remove the useless "Content Roots" at the right on the screen.

    enter image description here



    Old solution for reference:

    • Close PyCharm.
    • Open the faulty project's <root>/.idea/<project>.iml and remove all XML entries that refer to content outside the project:

    enter image description here

    • Save the file and reopen PyCharm. The project displays normally again.