Fatal crash with Freestyle SVG Export when rendering to a directory that does not exist yet #104723
Operating system: macOS-13.4.1-x86_64-i386-64bit 64 Bits
Graphics card: Metal API AMD Radeon Pro 5600M 1.2
Broken: version: 3.6.0, branch: blender-v3.6-release, commit date: 2023-06-27 08:08, hash:
Worked: no version that I'm aware of
Name: Freestyle SVG Exporter (1, 0)
Author: Folkert de Vries
Short description of error
- Render locations that need to be created before saving a render output result in fatal crash when Freestyle SVG Export is enabled
Exact steps for others to reproduce the error
- Create new project
- Enable Freestyle SVG Export
- Define render path by typing in a location instead of using the folder browser (for example,
//../Renders/Fileif the folder
Rendersdoes not yet exist next to the current project directory)
- Render still frame OR animation (either one will cause a fatal crash)
- The rendering path is automatically created by Blender when rendering raster images (Freestyle SVG Export does not, causing a fatal Blender crash)
Terminal Output from Crash
Traceback (most recent call last): File "/Applications/Blender.app/Contents/Resources/3.6/scripts/addons/render_freestyle_svg.py", line 276, in svg_export_header with open(create_path(scene), "w") as f: FileNotFoundError: [Errno 2] No such file or directory: '[redacted for privacy]/Renders/Vector/Vector 0010.svg' Error: Python: Traceback (most recent call last): File "<string>", line 1, in <module> File "/Applications/Blender.app/Contents/Resources/3.6/scripts/freestyle/modules/parameter_editor.py", line 1587, in process fn(scene, layer, lineset) File "/Applications/Blender.app/Contents/Resources/3.6/scripts/addons/render_freestyle_svg.py", line 614, in lineset_post cls.shader.write() File "/Applications/Blender.app/Contents/Resources/3.6/scripts/addons/render_freestyle_svg.py", line 408, in write tree = et.parse(self.filepath) File "/Applications/Blender.app/Contents/Resources/3.6/python/lib/python3.10/xml/etree/ElementTree.py", line 1222, in parse tree.parse(source, parser) File "/Applications/Blender.app/Contents/Resources/3.6/python/lib/python3.10/xml/etree/ElementTree.py", line 569, in parse source = open(source, "rb") FileNotFoundError: [Errno 2] No such file or directory: '[redacted for privacy]/Renders/Vector/Vector 0010.svg' Writing: /var/folders/wg/26qdxl5d6sv7f8r7r1yzyf0sjw8txq/T/Vector.crash.txt zsh: segmentation fault /Applications/Blender.app/Contents/MacOS/Blender
See attached txt file for full crash report.
I haven't looked into the SVG plugin itself, but this is a variation of the code used in VF Autosave Render + Output Variables that creates the render directory if it doesn't already exist.
import os absolute_path = bpy.path.abspath(bpy.context.scene.render.filepath) path_dir = os.path.dirname(absolute_path) if not os.path.exists(path_dir): os.makedirs(path_dir)
Hi, thanks for the report. Can confirm the crash. Crash appears to be due to missing directory.
Could you submit PR for proposed fix?
My bad. You've committed to your repo and I thought it's "main" 😅 , reopening.
No due date set.
No dependencies set.
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?