[Fixed]-Django project not opening in PyCharm due to strange error with \.idea\workspace.xml?

1👍

Sounds like .idea\workspace.xml got corrupted during the windows crash. It’s possible that other project files in the .idea dir and/or in the source code itself may be corrupted as well.

Before anything else I’d exit pycharm and make a copy of the entire project dir (think disaster recovery) which can be cloned as many times as needed during recovery attempts.

If you have your source code and/or the .idea under a version control system you could restore the most recent committed version from there and maybe even recover some of the uncommitted work from the corrupted workspace as well (manually).

Assuming you don’t have it under version control…

Remove the .idea\workspace.xml file (which should only contain non-critical info about the project, like which files were open, in which position, window size and location, etc). Start pycharm and watch for complaints. If the .idea\workspace.xml file was the only one corrupted you should be back in business.

If not then wipe the entire .idea subdir to erase all traces of the project being a pycharm project before. Then create a new pycharm project by Importing Project from Existing Source Code:

To create a new project from existing source code

  1. On the main menu, choose File | Open.
  2. In the dialog that opens, select the directory that contains the desired source code. Note that applications created externally are
    marked with the regular directory icon folder.
  3. Click OK.
  4. Specify whether you want the new project to be opened in a separate window or close the current project and reuse the existing
    one. Refer to the section Opening Multiple Projects for details.

This should re-create the .idea dir, but with some default project settings. You could re-do all configuration changes inside pycharm.

But you could also try to go even further and check the diffs between the files in the new project’s .idea dir and the old ones (which you can find in a clone of the backed-up project dir) – you might be able to restore some of the customisations you had in the old project by manually modifying the new project’s config files. Be sure to exit pycharm while attempting this – it doesn’t like its config files being modified while it’s running. And be careful so that you don’t cause new corruptions yourself. Make backup copies of the files that you intend to modify manually so that you can easily revert any incorrect changes. To test the changes try to start pycharm and watch for complaints.

Leave a comment