Hi all,
I’m sure it’s right in front of me but I can’t see it:
In order to work around the issue of shot status icons not coming through in a pdf, I have set up a custom shot field called “sg_status_text”.
My code populaes this with the sg_status_list names/display value using the native sg_status_list field as the key. When testing the code it all works fine, but inside my event daemon plugin I get errors claiming the sg instance passed into the plugin cannot find the custom field:
Traceback (most recent call last):
File "D:\pipeline\tools\python\shotgun_events\src\shotgunEventDaemon.py", line 970, in process
self._callback(self._shotgun, self._logger, event, self._args)
File "d:/pipeline/tools/python/shotgun_events/plugins\shot_status_update.py", line 85, in update_status_text
sg.update("Shot", shot_id, sg_status_text=status_name_dict[new_value])
TypeError: update() got an unexpected keyword argument 'sg_status_text'
If I create a new sg instance it works, but that does not seem efficient.
This is my simplified plugin code:
def update_status_text(sg, logger, event, args):
## Set some variables for convenience:
shot_id = event["meta"]["entity_id"]
new_value = event["meta"]["new_value"]
status_name_dict = sg.schema_field_read("Shot","sg_status_list")["sg_status_list"]["properties"]["display_values"]["value"]
logger.info("new value is {} > {}".format(new_value, status_name_dict[new_value]))
# do the deed:
sg.update("Shot", shot_id, sg_status_text=status_name_dict[new_value])
If I change the last line to use a new instance for the api handle (instead of the one passed into the plugin) it all works fine. I.e.:
my_sg = shotgun_api3.Shotgun(SERVER_PATH, SCRIPT_NAME, SCRIPT_KEY)
my_sg.update("Shot", shot_id, sg_status_text=status_name_dict[new_value])
Why would the existing api handle not know the custom field? It definitely exists:
Cheers,
frank