Operating system: Windows 10 Pro
Graphics card: GeForce RTX 2080
Broken: 2.92.0, 02948a2cab44, master, 2021-02-24 16:25
Worked: I would not know if this used to work.
**Short description of error**
Hopefully, I am approaching something the wrong way here, but it seems that there might be a small oversight concerning the timing at which the `save_pre` handlers are processed. If a Blender file is read-only, the `save_pre` handlers will not be triggered because the `Cannot save blend file, path 'C:\my\blender\file.blend' is not writable` error is raised before that can happen.
As a result, a mechanism that unlocks a file before saving it cannot be implemented.
In my case, this is making it impossible to create an add-on that will integrate versioning systems such as Perforce or Git into Blender.
I suppose there are cases where you would not want to trigger the `save_pre` routine unless a file was actually writeable, but checking that should probably be the responsibility of whoever implements the handler.
**Exact steps for others to reproduce the error**
- Open Blender.
- Run the following Python script using the Text Editor:
from bpy.app.handlers import persistent
def save_pre_handler(*args, **kwargs):
print("Doing something before saving.")
- Open the system console (Window > Toggle System Console).
- Save the file (File > Save).
- You should see `Doing something before saving.` printed in the system console.
- Make the file read-only (Right-click > Properties > Check `Read-only` checkbox).
- Save the file again (File > Save).
- Blender will raise an error and `Doing something before saving.` will not be printed in the system console.
Thanks in advance for your consideration.