Keep getting errors when randomly changing DomeLight intensity attribute

Hi Replicator gurus

I’m looking to alter the intensity attritute for a DomeLight in the scene by using

def rand_skylight():
sky_light=rep.get.prims(path_pattern=‘/Environment/DomeLight’)

with sky_light:
    rep.modify.attribute('intensity',rep.distribution.uniform(500,2500))
return sky_light.node 

However it keeps showing errors “this prim doesn’t have intensity attribute” when running the script.

I’ve read the article Randomizer Examples — Omniverse Extensions latest documentation but still have no cludes what’s causing it.

Any ideas?

Thanks heaps.

Give this script a try, I just tested it works. You must use inputs:intensity. Was there some documentation that you were following thats out of date?

import omni.replicator.core as rep

with rep.new_layer():
    # Could also use get prim at path
    #domelight = rep.get.prim_at_path('/Environment/sky')
    domelight = rep.get.prims(path_pattern='/Environment/sky')

    def rand_domelight(domelight):
        with domelight:
            # You must use inputs:intensity
            rep.modify.attribute("inputs:intensity", rep.distribution.uniform(10,10000))
        return lights.node
    rep.randomizer.register(rand_domelight)

    # Render 20 frames, with 50 subframes
    with rep.trigger.on_frame(num_frames=20, rt_subframes=50):
        rep.randomizer.rand_domelight(domelight)

tested your script and worked as dream. Brilliant!

Thank you so much. Got stuck with this for weeks. the article in my post may not be the latest.