shotgunsoftware / python-api

A Python-based library for accessing Flow Production Tracking API.
https://developer.shotgridsoftware.com/python-api
Other
306 stars 198 forks source link

SG-34200 Add python 3.12 support #317

Closed slingshotvfx closed 7 months ago

slingshotvfx commented 9 months ago

Updates six.py, which fixes:

  File "Z\shotgun_api3\shotgun.py", line 36, in <module>
    from .lib.six.moves import map
ModuleNotFoundError: No module named 'shotgun_api3.lib.six.moves'

in python 3.12

jfboismenu commented 8 months ago

It would be great if this could be merged in. We had to do the same fix to get the API to load in 3.12.1.

We first tried to change the way moves was imported, by doing from .lib.six import moves, and then picking out the classes and functions one by one as such:

map = moves.map
httpcookie_jar = moves.httpcookie_jar
urllib = moves.urllib

but once the code hit urllib, it crashed deep in the internals of six.py, which indicates that six.py is not compatible.

We were able to confirm the non-compatibility of six 1.13.0, which is what is shipped with the Shotgun API, by installing six 1.13.0 directly into Python 3.12.1, and reproducing the error by doing from six.moves import urllib.

This does not fail under Python 3.11 and below.

Upgrading to six to 1.16.0 inside the Shotgun API solves that problem.

carlos-villavicencio-adsk commented 7 months ago

@slingshotvfx thank you for your contribution. Our team has reviewed this and since we're dropping support for Python 2, six will also be removed anytime.