Page MenuHome

Crash when saving a Blender Image in a Python script
Closed, ResolvedPublic

Description

System Information
Windows 10 Home, GTX 1070 8GB

also reproduced on:
Windows 10, GTX 1070 8GB
Windows 10 Professional, GTX Titan Xp 12GB
Windows 10 Professional, GTX 1060 6GB

Blender Version
Broken: 2.79 5e5f2ead437 (2018-08-27 17:58)
Worked: 2.79 5bd8ac9

Short description of error

Blender crashes immediately when running the following script which creates and saves Blender Images:

import bpy, os

icon_directory = os.path.join(bpy.context.user_preferences.filepaths.temporary_directory, "temp_icons")
os.makedirs(icon_directory, exist_ok=True)
for i in range(100):
    image = bpy.data.images.new("iconimg" + str(i), width=32, height=32)
    image.filepath_raw = os.path.join(icon_directory, str(i) + ".png")
    image.file_format = 'PNG'
    image.save()

This crash has been noticed to occur when using the nightly builds since about one week ago. Sometimes the script will successfully write a few images, but will eventually crash. Very often the crash will occur after writing a single image.

Exact steps for others to reproduce the error

  1. Open the attached .blend file in Blender
  2. Press the 'Run Script' button to execute the script

Event Timeline

Ryan G (rlguy) updated the task description. (Show Details)

What error are you getting? Running blender from the command line might provide some info.

Here is the error message that I get when running from the command line:

Error   : EXCEPTION_ACCESS_VIOLATION
Address : 0x00007FFC913A6DA1
Module  : C:\Users\ryanl\Downloads\blender-2.79.0-git.5e5f2ead437-windows64\pthreadVC2.dll

Another Blender user has let me know about this similar error that they receive using build 9abc2dfa493:

Error   : EXCEPTION_ACCESS_VIOLATION
Address : 0x00007FFA7C846DA1
Module  : C:\Program Files\Blender Foundation\Blender\pthreadVC2.dll
Brecht Van Lommel (brecht) lowered the priority of this task from Needs Triage by Developer to Confirmed, Medium.