1

Project I have been working on in pycharm for some time was closed. When I reopen it it has lost its sources root completely as well as its interpreter. File list is completely brown background as result. . In settings Project: section doesn't even appear so I can't use that to pick the source root.

What the heck causes this and how can I fix it? I have seen it happen more than once over the years I have used pycharm. I tried removing .idea directory after closing project and reopening to no avail. Other projects are all fine and this one was too when it was last opened a few days ago.

Also when I open settings and click on Python Interpreter is gives "Nothing to show" instead of a pick box to pick and interpreter or add one.

Samantha Atkins
  • 658
  • 4
  • 12
  • I thought I fixed it by creating new project and pointing it add this directory. But as soon as I changed the virtual env the same thing happened again. Annoying this is. But I did have the Project: section in Settings this time so I could set the project root. – Samantha Atkins Oct 30 '21 at 19:45
  • The recent PyCharm update could cause problems with previous project layouts. See [this thread](https://stackoverflow.com/q/69379983) the simplest solution is to remove the sources and contents roots in the Settings and add them again (don't forget to invalidate the cache afterwards or the IDE might revert the changes you made). The brown/yellow background in the Project files is just a symptom of the former [it means files aren't part of the project](https://stackoverflow.com/a/68615067). – bad_coder Oct 30 '21 at 19:57
  • What I did "fixed it" after I corrected the source root once Project: section of settings reappeared. – Samantha Atkins Oct 31 '21 at 03:13

1 Answers1

0

I fixed it by using Create New Project and pointing it to the directory and telling it to use existing sources. But I would still like to know what causes this and whether there is a better way to fix it.

Samantha Atkins
  • 658
  • 4
  • 12