Search code examples
pythonpycharmconfiguration-files

PyCharm 2021.1.1 : Cannot load settings from file error


Whenever I open PyCharm I get 2 warnings as marked with red in the image below :

enter image description here

The warnings are :

Load Settings

Cannot load settings from file 'F:\Restframework\ .idea\Restframework.iml':File F:\Restframework.idea\Restframework.iml does not exist Please correct the file content

and

Load Settings

Cannot load settings from file 'P:\Website Codes\Restframework\ .idea\Restframework.iml':File P:\Website Codes\Restframework.idea\Restframework.iml does not exist Please correct the file content

I don't have any F: drive in my laptop and in Website Codes folder in P: drive there is no Restframework folder. So , why I'm getting such warnings and what I'm supposed to do to avoid these warnings ??


Solution

  • The error message:

    Load Settings

    Cannot load settings from file (...)

    is saying that the projects cannot be found at the paths specified in the settings files in each project's .idea folder. (This can happen for lots of reasons, the project files were moved, the drive letter changed, the .idea folder was copied from computer to another that has different paths, etc...)

    Before solving the problem it's important to understand how projects work in PyCharm. Each project is defined by having 1 .idea folder (as explained in the above link). But you can open multiple projects in one window using "Attach Project" which causes 1 entry in the 1st project's workspace.xml file to each attached project (take notice that each individual project still has its own .idea folder with its own setting files in it).

    You can fix this in several ways. First try to Delete a project from view to get rid of the projects that might be causing the error, this removes references to "Attached Projects" from the 1st project.

    If afterwards there are still projects causing these errors you can try to fix the settings files of each individual project. One way of doing this is deleting the .idea folder in each project and reopening the project so PyCharm recreates the folder (backup the folder before deleting). You can also try to open the settings files and try to fix the paths inside them (this is a more complicated solution that requires being able to understand the contents of the settings files).