Event ID error

All my scripts are throwing up an error of event log id is missing . the below is the script for which the error is being thrown.
# Return if we don’t have all the field values we need.
if (
not event.get(“entity”, {}).get(“id”)
or not event.get(“meta”, {}).get(“entity_id”)
or not event.get(“id”)
How come there will be no id for the event created.

Did you try printing out the event?
if you have light payload enabled, you would have event["event_log_entry_id"], which you have to fetch in order to get the actual event.
Otherwise, there should be event["selected_ids"] or event["ids"].

Here is a larger example for light payloads

    if "event_log_entry_id" in request_data:
        logger.debug("Received event id, fetching event")
        event_log_entry = sg.find_one(
            [["id", "is", int(request_data["event_log_entry_id"][0])]],

        request_data = event_log_entry["meta"]["ami_payload"]
1 Like

Hi , Thanks for the reply. I am writing this incase if there is no event id or or all the fields i require is missing so that the script returns and not continue further. But instead of returning my script throws an error of NONE type attribute is not scriptable. For example , Below is my script inside the function.

Return if we don’t have all the field values we need.

if (
    not event.get("entity", {}).get("id")
    or not event.get("entity", {}).get("name")
    or not event.get("id")

# Make some vars for convenience.
new_value = event.get("meta", {}).get("new_value")
event_id = event.get("id")
entity_id = event["entity"]["id"]
entity_name = event["entity"]["name"]
old_task_status = "com"

# Re-query for the Task Status value to make sure we have an up-to-date
# new status value. The input value from the event may be inaccurate if the
# triggers are ever running behind.
sg_task: object = sg.find_one("Task",
                              [["id", "is", entity_id],
                               ["content", "contains", "Lighting Summary Task"]],

# Check if the status changed of the task is completed and if not return
if new_value == old_task_status:
    if sg_task:
        find_linked_Polish_task(sg, logger, new_value, sg_task)

if new_value != old_task_status:

# Return if we can't find our Task.
if not sg_task:
        "Unable to retrieve Task (%d) %s from SG for event %d, skipping."
        % (entity_id, entity_name, event["id"])

Also I wrote the same in all the scripts, every now and then my script goes inactive because of the error. Is there a way i can change the script so that i dont get this error.

I think you need to add a bit more debug logging because you can’t be sure that the event has no id with the above script.

Nonetype object is not subscriptable will likely be caused by these lines:

entity_id = event["entity"]["id"]
entity_name = event["entity"]["name"]

if there is no entity, for example. Use .get(keyname) instead of [keyname] syntax so you can check for the value without it erroring.

Please post the entire error trace, this way it is difficult to tell where it goes wrong.

Hey Guys, Thanks for the reply. Let me be clear this time. I am trying to automate a status from one task to another task. When there s a change in task_ to completed, Task two must automatically move to ready for work. There are two issues when i try.

Traceback (most recent call last):
File “/usr/local/shotgun/shotgunEvents/src/shotgunEventDaemon.py”, line 1145, in process
self._callback(self._shotgun, self._logger, event, self._args)
File “/usr/local/shotgun/events-larian/plugins/anim_sum_anim_comp_rollup.py”, line 72, in AnimSumAnimCompTask
not event.get(“entity”, {}).get(“id”)
AttributeError: ‘NoneType’ object has no attribute ‘get’

This one shows for the above script.

And I need to filter out a task based on the entity since there is same task name for many pipeline steps.
sg_task: object = sg.find_one(“Task”,
[[“id”, “is”, entity_id],
[“content”, “contains”, “Lighting Summary Task”]
Traceback (most recent call last):
File “shotgunEventDaemon.py”, line 1104, in process
self._callback(self._shotgun, self._logger, event, self._args)
File “C:/Shotgrid_Server/shotgunEvents/src/plugins\lightsumpolishrevrollup.py”, line 95, in LightSumPolishRevrollup
TypeError: list indices must be integers or slices, not tuple.

Is there any other to filter these? Thanks for the help

The entity is None, which means the event has an empty entity field - thus event.get returns None

In the second example, you are missing a comma after “Lighting Summary Task”.

    sg_task: object = sg.find_one(
            ["id", "is", entity_id],
            ["content", "contains", "Lighting Summary Task"],
            ["step.Step.short_name", "in", ["LGHT"]],
            ["sg_status_list", "entity"]

Fixed it for you here based on @mmoshev 's comment and made it a bit more readable.

p.s. to post code snippets and tracebacks on the forum, use markdown notation, the forum can also highlight syntax by writing like this:

1 Like

Thank you guys .

1 Like