Fatal crash with Freestyle SVG Export when rendering to a directory that does not exist yet #104723

Closed
opened 2023-06-29 17:20:05 +02:00 by John Einselen · 4 comments

System Information
Operating system: macOS-13.4.1-x86_64-i386-64bit 64 Bits
Graphics card: Metal API AMD Radeon Pro 5600M 1.2

Blender Version
Broken: version: 3.6.0, branch: blender-v3.6-release, commit date: 2023-06-27 08:08, hash: c7fc78b81ecb
Worked: no version that I'm aware of

Addon Information
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/File if the folder Renders does not yet exist next to the current project directory)
  • Render still frame OR animation (either one will cause a fatal crash)

Expected behaviour

  • 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.

Potential Solution?

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)
**System Information** Operating system: macOS-13.4.1-x86_64-i386-64bit 64 Bits Graphics card: Metal API AMD Radeon Pro 5600M 1.2 **Blender Version** Broken: version: 3.6.0, branch: blender-v3.6-release, commit date: 2023-06-27 08:08, hash: `c7fc78b81ecb` Worked: no version that I'm aware of **Addon Information** 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/File` if the folder `Renders` does not yet exist next to the current project directory) - Render still frame OR animation (either one will cause a fatal crash) **Expected behaviour** - 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. **Potential Solution?** 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) ```
John Einselen added the
Type
Report
Priority
Normal
Status
Needs Triage
labels 2023-06-29 17:20:06 +02:00
Member

Hi, thanks for the report. Can confirm the crash. Crash appears to be due to missing directory.
Could you submit PR for proposed fix?

Hi, thanks for the report. Can confirm the crash. Crash appears to be due to missing directory. Could you submit PR for proposed fix?
Pratik Borhade added
Status
Confirmed
Module
Add-ons (Community)
and removed
Status
Needs Triage
labels 2023-08-09 07:13:35 +02:00
Member

@ChengduLittleA has committed the fix: 3f1674ef52 , closing.

@ChengduLittleA has committed the fix: https://projects.blender.org/ChengduLittleA/blender-addons/commit/3f1674ef5213d1c369f5039614d62742fe4b4a5f , closing.
Blender Bot added
Status
Archived
and removed
Status
Confirmed
labels 2023-08-11 05:23:55 +02:00
Member

Thanks @PratikPB2123 for directing me to this report. I created a patch and changed the reference to this issue.

Thanks @PratikPB2123 for directing me to this report. I created a patch and changed the reference to this issue.
Member

@ChengduLittleA has committed the fix: 3f1674ef52 , closing.

My bad. You've committed to your repo and I thought it's "main" 😅 , reopening.

> @ChengduLittleA has committed the fix: https://projects.blender.org/ChengduLittleA/blender-addons/commit/3f1674ef5213d1c369f5039614d62742fe4b4a5f , closing. My bad. You've committed to your repo and I thought it's "main" 😅 , reopening.
Pratik Borhade added
Status
Confirmed
and removed
Status
Archived
labels 2023-08-11 05:27:31 +02:00
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2023-08-11 05:42:10 +02:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#104723
No description provided.