Regression: Calling save on image fails due to file path options not being correctly applied #98305

Closed
opened 2022-05-21 19:40:42 +02:00 by Bill Ortis · 27 comments

System Information
Operating system: Windows-10-10.0.19044-SP0 64 Bits
Graphics card: NVIDIA GeForce GTX 1660 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 512.59

Blender Version
Broken:

  • version: 3.3.0 Alpha, branch: master, commit date: 2022-05-20 22:53, hash: dfb8c90324
  • Broken since 29a3f43da5
    Worked:
  • Before 29a3f43da5

Short description of error
Setting filepath_raw on an bpy.types.Image object and then calling save() results in the error:

imb_savepng: Cannot open file for writing: ''
Invalid argument
Error: Python: Traceback (most recent call last):
  File "\Text", line 9, in <module>
RuntimeError: Error: Could not write image: Invalid argument
Error: Image 'temp' could not be saved to 'C:\Users\user\AppData\Local\Temp\tmpb7if1xli/img'

This issue affects the glTF exporter and third-party add-ons such as Blender2MSFS2.

Exact steps for others to reproduce the error

  • Execute the following script from the text editor
import tempfile
import bpy

tmp_image = bpy.data.images.new("temp", 4, 4)

with tempfile.TemporaryDirectory() as tmpdirname:
    tmpfilename = tmpdirname + '/img'
    tmp_image.filepath_raw = tmpfilename
    tmp_image.save()
**System Information** Operating system: Windows-10-10.0.19044-SP0 64 Bits Graphics card: NVIDIA GeForce GTX 1660 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 512.59 **Blender Version** Broken: - version: 3.3.0 Alpha, branch: master, commit date: 2022-05-20 22:53, hash: `dfb8c90324` - Broken since 29a3f43da5 Worked: - Before 29a3f43da5 **Short description of error** Setting `filepath_raw` on an `bpy.types.Image` object and then calling `save()` results in the error: ``` imb_savepng: Cannot open file for writing: '' Invalid argument Error: Python: Traceback (most recent call last): File "\Text", line 9, in <module> RuntimeError: Error: Could not write image: Invalid argument Error: Image 'temp' could not be saved to 'C:\Users\user\AppData\Local\Temp\tmpb7if1xli/img' ``` This issue affects the glTF exporter and third-party add-ons such as Blender2MSFS2. **Exact steps for others to reproduce the error** - Execute the following script from the text editor ``` import tempfile import bpy tmp_image = bpy.data.images.new("temp", 4, 4) with tempfile.TemporaryDirectory() as tmpdirname: tmpfilename = tmpdirname + '/img' tmp_image.filepath_raw = tmpfilename tmp_image.save() ```
Author

Added subscriber: @lionheart001

Added subscriber: @lionheart001

Added subscriber: @rjg

Added subscriber: @rjg

Is it correct that you are using the Blender2MSFS2
third-party add-on from this repository https://github.com/tml1024/Blender2MSFS2 ?

Is it correct that you are using the Blender2MSFS2 third-party add-on from this repository https://github.com/tml1024/Blender2MSFS2 ?
Contributor

Added subscriber: @scurest

Added subscriber: @scurest
Contributor

Note that the same thing happened in CI for the glTF addon repo. https://github.com/KhronosGroup/glTF-Blender-IO/pull/1646#issuecomment-1132006357

Note that the same thing happened in CI for the glTF addon repo. https://github.com/KhronosGroup/glTF-Blender-IO/pull/1646#issuecomment-1132006357

Added subscriber: @JulienDuroure

Added subscriber: @JulienDuroure

@scurest Thank you for noticing. Seems like this could be an issue in Blender and needs further investigations, if this occasionally fails with the official glTF add-on as well.

@scurest Thank you for noticing. Seems like this could be an issue in Blender and needs further investigations, if this occasionally fails with the official glTF add-on as well.
Member

@rjg I can confirm that exporting this file as glTF separated is ko since a few days (last ok CI was 5 days ago)
bea4c6d2c9/tests/scenes/01_principled_material.blend

@rjg I can confirm that exporting this file as glTF separated is ko since a few days (last ok CI was 5 days ago) https://github.com/KhronosGroup/glTF-Blender-IO/blob/bea4c6d2c9fb5c371518dc33c14c06e2ae4b3185/tests/scenes/01_principled_material.blend
Author

In #98305#1362260, @rjg wrote:
Is it correct that you are using the Blender2MSFS2
third-party add-on from this repository https://github.com/tml1024/Blender2MSFS2 ?

Yes, that is the one. A stable compiler. There are two out there, this one runs best. Version 42.10 by RonH

In #98305#1362276, @JulienDuroure wrote:
@rjg I can confirm that exporting this file as glTF separated is ko since a few days (last ok CI was 5 days ago)
bea4c6d2c9/tests/scenes/01_principled_material.blend

We export these 'seperated' also.

Bill

> In #98305#1362260, @rjg wrote: > Is it correct that you are using the Blender2MSFS2 > third-party add-on from this repository https://github.com/tml1024/Blender2MSFS2 ? Yes, that is the one. A stable compiler. There are two out there, this one runs best. Version 42.10 by RonH > In #98305#1362276, @JulienDuroure wrote: > @rjg I can confirm that exporting this file as glTF separated is ko since a few days (last ok CI was 5 days ago) > https://github.com/KhronosGroup/glTF-Blender-IO/blob/bea4c6d2c9fb5c371518dc33c14c06e2ae4b3185/tests/scenes/01_principled_material.blend We export these 'seperated' also. Bill

@JulienDuroure Are there any particular steps necessary, or does just an export of the project as-is to .glb fail? Does this fail consistently or occasionally?

Current master (dfb8c90324c018068f12ca41543c3c311dff6d21) seems to be working fine on my system with the provided file.

Edit: I have just noticed that the textures are not packed. I will test this again tomorrow with the textures, just in case that makes any difference.

@JulienDuroure Are there any particular steps necessary, or does just an export of the project as-is to `.glb` fail? Does this fail consistently or occasionally? Current master (`dfb8c90324c018068f12ca41543c3c311dff6d21`) seems to be working fine on my system with the provided file. Edit: I have just noticed that the textures are not packed. I will test this again tomorrow with the textures, just in case that makes any difference.
Member

Seems to break without any condition on github CI.

Don't have a computer to check right now, but did you change export format to glTF separated, instead of glb ?

Seems to break without any condition on github CI. Don't have a computer to check right now, but did you change export format to glTF separated, instead of glb ?

First test with glTF Separate seems to be working fine, but I will check again tomorrow with the images. Just so that we are not looking at different commits, could you please post one of the affected commit hashes that fails in your CI?

First test with glTF Separate seems to be working fine, but I will check again tomorrow with the images. Just so that we are not looking at different commits, could you please post one of the affected commit hashes that fails in your CI?
Contributor

I can repro with current alpha (blender-3.3.0-alpha+master.dfb8c90324c0-linux.x86_64-release). Binary/Separate etc. doesn't make a difference.

Reduced test case:

import tempfile
import bpy

tmp_image = bpy.data.images.new("temp", 4, 4)

with tempfile.TemporaryDirectory() as tmpdirname:
    tmpfilename = tmpdirname + '/img'
    tmp_image.filepath_raw = tmpfilename
    tmp_image.save()

Stick it in a text editor and run it. Fails with current alpha. Works on 3.1 & blender-3.3.0-alpha+master.08a39d32a988.

I can repro with current alpha (blender-3.3.0-alpha+master.dfb8c90324c0-linux.x86_64-release). Binary/Separate etc. doesn't make a difference. Reduced test case: ``` import tempfile import bpy tmp_image = bpy.data.images.new("temp", 4, 4) with tempfile.TemporaryDirectory() as tmpdirname: tmpfilename = tmpdirname + '/img' tmp_image.filepath_raw = tmpfilename tmp_image.save() ``` Stick it in a text editor and run it. Fails with current alpha. Works on 3.1 & blender-3.3.0-alpha+master.08a39d32a988.

@scurest I can reproduce the issue with your script (presumably the issue was not triggered with the exporter due to the missing images). I will update the ticket description tomorrow so that it is fully triaged and confirmed.

@scurest I can reproduce the issue with your script (presumably the issue was not triggered with the exporter due to the missing images). I will update the ticket description tomorrow so that it is fully triaged and confirmed.
Contributor

Possibly related to 29a3f43da5.

Possibly related to 29a3f43da5d3.
Robert Guetzkow changed title from Cannot Export glTF-2 files, getting error to Regression: Calling save on image fails due to file path options not being correctly applied 2022-05-22 10:54:20 +02:00

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

Added subscriber: @brecht

Added subscriber: @brecht

@brecht This is likely a ticket for you.
@scurest Thank you for looking into this.

@brecht This is likely a ticket for you. @scurest Thank you for looking into this.

This issue was referenced by eba6900b08

This issue was referenced by eba6900b083e78b70c328783382f99bb18da6099

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Brecht Van Lommel self-assigned this 2022-05-23 12:44:50 +02:00
Author

Just to let you know, I did test Build 3.3 May 23rd and May 24th (today) with exporting glTF-2 (MSFS format) separated. Build May 24th got quite a ways along before it crashed. Much better then the instant black crash screen. Must be close.

Bill
LHC

Just to let you know, I did test Build 3.3 May 23rd and May 24th (today) with exporting glTF-2 (MSFS format) separated. Build May 24th got quite a ways along before it crashed. Much better then the instant black crash screen. Must be close. Bill LHC
Member

Hello,
I confirm that there is no more issue on glTF exporter!
Thanks

Hello, I confirm that there is no more issue on glTF exporter! Thanks
Author

Just ran Blender 3.3 May 25th Build. I was able to export first half of the scene I am working on, but the interior section of the scene still fails. But... It is attempting to build it instead of just throwing out the error notice. It runs for several long seconds until the error pops up. So close...

Again, the file exports fine in Blender 3.1 and 3.2.

Error notice attached..

Screenshot 2022-05-25 081700.jpg

Just ran Blender 3.3 May 25th Build. I was able to export first half of the scene I am working on, but the interior section of the scene still fails. But... It is attempting to build it instead of just throwing out the error notice. It runs for several long seconds until the error pops up. So close... Again, the file exports fine in Blender 3.1 and 3.2. Error notice attached.. ![Screenshot 2022-05-25 081700.jpg](https://archive.blender.org/developer/F13104661/Screenshot_2022-05-25_081700.jpg)

The actual error is scrolled out of view, it would be at the very bottom. It should be easier to copy the text from the console window (Window > Toggle System Console in Blender).

The actual error is scrolled out of view, it would be at the very bottom. It should be easier to copy the text from the console window (Window > Toggle System Console in Blender).
Contributor

Removed subscriber: @scurest

Removed subscriber: @scurest
Author

Roger that, Brecht.

Got it.

Screenshot 2022-05-25 145017.jpg

Roger that, Brecht. Got it. ![Screenshot 2022-05-25 145017.jpg](https://archive.blender.org/developer/F13105873/Screenshot_2022-05-25_145017.jpg)
Author

Hello Team Blender,

I just wanted to report that I just tested Blender 3.3 Alpha May 26th Build with exporting glTF-2 in MSFS exporter by RonH, and..... IT WORKED!!!!!!!!!!!!!!!!!!!!!!!!!

Thank you Team Blender. I can once again begin testing Alpha daily. Very grateful for your help on this. God bless you.

Bill
LHC

Screenshot 2022-05-26 103720.jpg

Hello Team Blender, I just wanted to report that I just tested Blender 3.3 Alpha May 26th Build with exporting glTF-2 in MSFS exporter by RonH, and..... IT WORKED!!!!!!!!!!!!!!!!!!!!!!!!! Thank you Team Blender. I can once again begin testing Alpha daily. Very grateful for your help on this. God bless you. Bill LHC ![Screenshot 2022-05-26 103720.jpg](https://archive.blender.org/developer/F13110143/Screenshot_2022-05-26_103720.jpg)
Thomas Dinges added this to the 3.2 milestone 2023-02-08 15:51:07 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
6 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#98305
No description provided.