Problem with "register_publish" method

Hi, i got a problem with ‘sgtk.util.register_publish’, I trying to publish file from my script which use sgtk API which was installed using pip. I bootsrap an engine and use “register_publish” command but it return me an error:

group_by_storage() takes 2 positional arguments but 3 were given.

I have made a little investigation and find out that there is a problem inside PIP installed sgtk. When “publish_util.py” file is calling “group_by_storage” method in line 132 (line number can by little diffrent I have made a couple lines of logger). It’s looks like that:

storage_root_to_paths = group_by_storage(tk, list_of_paths, only_current_project)

It’s look fine but “group_by_storage” in file “publish_creatiuon.py” dosen’t accept that. Even though declaration looks ok, I understand that “only_current_project” is argument with default value here:

def group_by_storage(tk, list_of_paths, only_current_project=True):...

I dont understand why it isn’t accept “only_current_project” argument from “publish_util.py” , when I have removed it from there, it’s starts to work fine.

But I’am not sure that i should modify this library like that… maybe it’s some known issue? Or did I made some mistake?

Seems like two different versions of sgtk in play.
Just remove the one in pip. If something ever breaks, you will know to install it again.

It is kinda useful to use pdb for stuff like this, because you will see execution jump to the wrong module and say “a-ha!”

1 Like

Unfortunately I have tried on different PC, with clean instalation of python and SGTK and still get errors like:

“tank.util.errors.ShotgunPublishError: Unable to complete publishing because of the following error: group_by_storage() takes 2 positional arguments but 3 were given, although PublishedFile sh001_Deadline2020_Rnd_v023_EnvMIDLayer_beauty.%04d.exr (id: 64305) was created.”