PublishedFile does not show in Activity with Toolkit API

Hi, I’m wondering if anyone knows the solution of this toolkit API issue.
Basically I’m writing a custom publish tool with the pipeline toolkit. The tool copies a bunch of files and then executes sgtk.util.register_publish() . It seems working properly as I can see the PublishedFile entity on ShotGrid, but it doesn’t show up in the activity page. Also webhooks can’t catch the creation of the entity either. Anyone has the same experience?

BTW, following codes can recreate the symptom.

import sgtk


def get_authentication():
    from tank_vendor.shotgun_authentication import ShotgunAuthenticator

    cdm = sgtk.util.CoreDefaultsManager()

    authenticator = ShotgunAuthenticator(cdm)

    user = authenticator.create_script_user(
        host='https://your-site.shotgunstudio.com/',
        api_script='test',
        api_key='xxx...'
    )

    sgtk.set_authenticated_user(user)


def publish():
    get_authentication()

    file_to_publish = "/mnt/projects/proj/seq_abc/shot_123/comp/foreground.v003.%04d.exr"

    name = "foreground"

    tk = sgtk.sgtk_from_path(file_to_publish)

    ctx = tk.context_from_path(file_to_publish)

    sgtk.util.register_publish(
        tk,
        ctx,
        file_to_publish,
        name,
        published_file_type="Rendered Image",
        version_number=3
    )


if __name__ == '__main__':
    publish()

Is your APi Script set to “Generate Events”?
(It’s a field on a Script user).

if it does not generate events webhooks can not trigger and Activity Page updates dont show.

2 Likes

Hi Ricardo_Musch,

Thank you for your advice, you are right, I wasn’t setting the field True, I even didn’t know the field exists. It fixed my issue now, thank you again :smile:

1 Like