PyCharm 2021.2 Help

Non-Project Files Protection dialog

This dialog appears when you try to edit non-project files: library sources, external sources and so on. Such files are intentionally protected from modification. For example, it is not recommended that you change library classes as you are supposed to reuse them as is.

If you want to work with these files, add them to the content root. A content root in PyCharm is a folder that contain your source code, build scripts, unit tests, and documentation. In the Project tool window, this folder is marked with the Directory icon.

If you want to edit these files only once without adding them to your project, use one of the options in the dialog:

  • I want to edit this file anyway: select this option to disable protection for the listed files.

  • I want to edit all files in this directory: select this option to disable protection for the listed files and all files in the same directory.

  • I want to edit any non-project file in the current session: select this option to disable protection.

All options are effective during the current session, once the IDE is restarted, protection will be re-enabled. Also, you cannot change your decision for a particular file within the current session.

Workaround

  • An obvious solution to overcome file protection is to move the target file into a content root.

    Editing a non-project file

    In PyCharm, content is a collection of files with which you are currently working, possibly organized in a hierarchy of subfolders. The folder which is the highest in this hierarchy is called the content root folder or content root (shown as the Content root icon) for short. A project has at least one content root folder, which by default is the project folder itself.

  • If you're trying to adjust the structure of an old project, try to invalidate caches. From the main menu select File | Invalidate Caches.... In the opened dialog, click the Invalidate and Restart button.

Last modified: 01 September 2021