I’m facing a weird issue,
my script does several publishes using sgtk.util.register_publish() and then creates a version and links the various publishes to this version.
I have a context created with context_from_entity.
The register_publish functions work just fine and create publishes linked to my context.
The sg.create(“Version”, data) function errors out on the same context opbject with the following error:
TypeError: is not JSON serializable
Why?
This is the full log:
Traceback (most recent call last):
File “G:\Projects__SGToolkitMasterConfig_configs\shotgun__SGToolkitMasterConfig-sgtk-beta\install\app_store\tk-multi-publish2\v2.5.0\python\tk_multi_publish2\api\plugins\publish_plugin_instance.py”, line 280, in _handle_plugin_error
yield
File “G:\Projects__SGToolkitMasterConfig_configs\shotgun__SGToolkitMasterConfig-sgtk-beta\install\app_store\tk-multi-publish2\v2.5.0\python\tk_multi_publish2\api\plugins\publish_plugin_instance.py”, line 196, in run_publish
self._hook_instance.publish(settings, item)
File “G:\Projects__SGToolkitMasterConfig_configs\shotgun__SGToolkitMasterConfig-sgtk-beta\config\hooks\tk-multi-publish2\tk-nuke\editorial\ingest_tool\create_version_and_publish.py”, line 387, in publish
sg_version = sg.create(“Version”, data)
File “G:\Projects__SGToolkitMasterConfig_configs\shotgun__SGToolkitMasterConfig-sgtk-beta\install\core\python\tank_vendor\shotgun_api3\shotgun.py”, line 1363, in create
record = self._call_rpc(“create”, params, first=True)
File “G:\Projects__SGToolkitMasterConfig_configs\shotgun__SGToolkitMasterConfig-sgtk-beta\install\core\python\tank\authentication\shotgun_wrapper.py”, line 63, in _call_rpc
return super(ShotgunWrapper, self)._call_rpc(*args, **kwargs)
File “G:\Projects__SGToolkitMasterConfig_configs\shotgun__SGToolkitMasterConfig-sgtk-beta\install\core\python\tank_vendor\shotgun_api3\shotgun.py”, line 3291, in _call_rpc
encoded_payload = self._encode_payload(payload)
File “G:\Projects__SGToolkitMasterConfig_configs\shotgun__SGToolkitMasterConfig-sgtk-beta\install\core\python\tank_vendor\shotgun_api3\shotgun.py”, line 3417, in encode_payload
wire = json.dumps(payload, ensure_ascii=False)
File "C:\Program Files\Nuke11.3v6\lib\json_init.py", line 251, in dumps
sort_keys=sort_keys, **kw).encode(obj)
File “C:\Program Files\Nuke11.3v6\lib\json\encoder.py”, line 207, in encode
chunks = self.iterencode(o, _one_shot=True)
File “C:\Program Files\Nuke11.3v6\lib\json\encoder.py”, line 270, in iterencode
return _iterencode(o, 0)
File “C:\Program Files\Nuke11.3v6\lib\json\encoder.py”, line 184, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: is not JSON serializable