Sg.upload() not working

This is more of a troubleshooting question than anything else.
I’m trying to upload a movie to a version through the API and it simply isn’t doing it.
I’ve tried multiple different movies from different directory locations
I’ve tried uploading through the web interface from the location I’m using and that works fine
I’ve tried uploading a thumbnail from the same location with the same syntax and that works as expected as well.
I’ve tried putting the version id and path in directly instead of passing them as variables
No luck.
Any suggestions?

SG_conn.upload(“Version”, ver_ID, mov_to_upload)

In prior code examples (that work just fine) Enitity, entity ID and path to the media was sufficient.
In this case it started working when I added the field to upload to. So, this worked:

SG_conn.upload(“Version”, ver_ID, mov_to_upload, ‘sg_uploaded_movie’)

Any idea why it would require it sometimes and not others?

I’m not sure why it would work without the field specified, I think it’s required.

Just some additional information on the topic:
this is a screen grab from the Developer Training video series

Not only does it show only using the Version, the Version ID, and the path to the file to upload, but the voice over explicitly states that only those three arguments are necessary.

That having been said, as I indicated above it wasn’t working for me and when I included the field name it did work. I guess I just wanted people to know where I got the impression it wasn’t required. :slightly_smiling_face:

https://developer.shotgridsoftware.com/python-api/reference.html#shotgun_api3.shotgun.Shotgun.upload

Seems that it is optional, but it doesn’t specify what field-name is used if you don’t supply one. I can only assume it’s not the same field name that you are using.

Probably unrelated but jic

We had an upload issue with SG versions and it was an AWS cert issue on the machine.
Scripts would fail to upload to SG but this article helped us fix.

https://github.com/shotgunsoftware/developer.shotgunsoftware.com/blob/master/docs/en/quick-answers/troubleshooting/fix-ssl-certificate-verify-failed.md

It’s optional because you can upload files to SG and just retrieve the id of the uploaded attachment to then use.

But if you want to see this play in the browser you have to state the field, either the sg_uploaded_movie or sg_uploaded_movie_mp4 field (DIY transcoding).

1 Like

Thank you for the clarification. That makes perfect sense.

1 Like