unreal.AutomationLibrary.take_high_res_screenshot

i think there is no wrong in code, but it always turns out only save for the last “7a15.png”. i tried “print(“Processing iteration: {}, {}”.format(i, j))” and it’s alright.
Does that mean HighReShot cannot take photos >1 at one time?
thx for any reply🥰im so confused…

here’s my code:

import unreal
import random
import os

light = unreal.AssetData('/Game/8-19-2023.8-19-2023:PersistentLevel.DirectionalLight_0').get_asset()

y_rots = [random.randint(200, 214) for i in range(4)]

save_path = r"E:/stone_dataset/"

prefix = "7a"
k = 0

for i, y_rot in enumerate(y_rots):

    z_rots = [random.randint(0, 300) for j in range(4)]

    for j, z_rot in enumerate(z_rots):
        rotation = unreal.Rotator(0, y_rot, z_rot)
        light.set_actor_rotation(rotation, False)

        screenshot = unreal.AutomationLibrary.take_high_res_screenshot(2048, 2048,
                                                                       filename=os.path.join(save_path, "{}{}.png".format(prefix, k)))
        k += 1
print("{}截图完成!".format(prefix))

:card_file_box:oh ignore the wrong indent in the last two lines…
:card_file_box:there is also some output log info proviede:

LogShaderCompilers: Display: ================================================
LogShaderCompilers: Display: === FShaderJobCache stats ===
LogShaderCompilers: Display: Total job queries 0, among them cache hits 0 (0.00%)
LogShaderCompilers: Display: Tracking 0 distinct input hashes that result in 0 distinct outputs (0.00%)
LogShaderCompilers: Display: RAM used: 0.00 MB (0.00 GB) of 716.80 MB (0.70 GB) budget. Usage: 0.00%
LogShaderCompilers: Display: === Shader Compilation stats ===
LogShaderCompilers: Display: Shaders Compiled: 0
LogShaderCompilers: Display: Jobs assigned 0, completed 0 (0.00%)
LogShaderCompilers: Display: Time at least one job was in flight (either pending or executed): 0.00 s
LogShaderCompilers: Display: ================================================
LogContentStreaming: Blocking on texture streaming: 0.0 ms (0 still in flight)
LogContentStreaming: Blocking on texture streaming: 0.0 ms (0 still in flight)
LogContentStreaming: Blocking on texture streaming: 0.0 ms (0 still in flight)
LogContentStreaming: Blocking on texture streaming: 0.0 ms (0 still in flight)
LogContentStreaming: Blocking on texture streaming: 0.0 ms (0 still in flight)
LogContentStreaming: Blocking on texture streaming: 0.0 ms (0 still in flight)
LogContentStreaming: Blocking on texture streaming: 0.0 ms (0 still in flight)
LogContentStreaming: Blocking on texture streaming: 0.0 ms (0 still in flight)
LogContentStreaming: Blocking on texture streaming: 0.0 ms (0 still in flight)
LogContentStreaming: Blocking on texture streaming: 0.0 ms (0 still in flight)
LogContentStreaming: Blocking on texture streaming: 0.0 ms (0 still in flight)
LogContentStreaming: Blocking on texture streaming: 0.0 ms (0 still in flight)
LogContentStreaming: Blocking on texture streaming: 0.0 ms (0 still in flight)
LogContentStreaming: Blocking on texture streaming: 0.0 ms (0 still in flight)
LogContentStreaming: Blocking on texture streaming: 0.0 ms (0 still in flight)
LogContentStreaming: Blocking on texture streaming: 0.0 ms (0 still in flight)
LogPython: 7a截图完成!
LogClient: High resolution screenshot saved as E:/stone_dataset/7a15.png

Do you have a solution now?