Page MenuHome

Writing images to library files in temp directory results in empty data on WIN32
Needs Triage, NormalPublic


System Information
Operating system: Windows 10
Graphics card: NVIDIA Quadro P4200 (likely irrelevant)

Blender Version
Broken: 2.82
Worked: 2.81a

Short description of error

Writing images to the System's 'temp' directory on Windows via results in empty data

Exact steps for others to reproduce the error

  1. From default startup, open any image into Blender (e.g. via the UV Editing workspace)
  2. Run the following script:
import bpy
import tempfile
import os

data_blocks = set([[0]])

path1 = os.path.join(os.path.expanduser("~"), "Desktop", "texture_issue_lib.blend")
path2 = os.path.join(tempfile.gettempdir(), "texture_issue_lib.blend")
print(path2), data_blocks, fake_user=True), data_blocks, fake_user=True)
  1. Open a new default startup file, and append the images written to the library files at the paths printed by the script above.
  2. Examine the images. Assuming your results match mine, the image appended from your desktop will have data, while the image appended from your temp directory will not have data.

Event Timeline

Tested on Linux, both files are the same size. Maybe it's spesific to windows.

Campbell Barton (campbellbarton) renamed this task from Writing images to library files in temp directory results in empty data to Writing images to library files in temp directory results in empty data on WIN32.Thu, Feb 13, 3:18 AM

Ah, I have new information.

The problem is not actually on writing the files - the files are the same size for me as well. The problem is in appending the data. If I take the library file from my desktop and copy it into my Temp folder, the image appends without data, but if I place it back on my desktop, the image appends fine with all of its data.

I've also confirmed the same issue is present on MacOS.

I also cannot reproduce the problem. Am I doing something wrong?

Operating system: Windows-10-10.0.18941 64 Bits

Perhaps it has something to do with the image file I'm using? Here's the image file:

Germano Cavalcante (mano-wii) changed the task status from Needs Triage to Needs Information from User.Mon, Feb 17, 1:44 PM

Also could not reproduce the problem with the image attached.
This can be a problem when reading the directory (special characters or something).
Which directory is printed in print(path2)?

I won't have access to my Windows machine at the moment, but I believe it was something like this:


I did notice that, for my Mac at least, the problem doesn't seem to happen when run from default startup – only when run using my bare-bones test file. I've attached the file below.

Christopher Gearhart (bblanimation) changed the task status from Needs Information from User to Needs Triage.Mon, Feb 17, 2:36 PM

I have a bit more information as I continue to investigate:

The problem seems to be that for some reason, my image does not have data. If I type the following into the console:


It prints:


I imagine this has something to do with why the image does not write correctly. Perhaps the image is not properly loaded when opening the blend file?