0

Shotgun and Nuke

Was wondering if anyone had integrated Shotgun into Nuke scripts.  I have a few ideas and will be doing some stuff to retrieve element list, cut summary info, possibly even build a note node in Nuke that asynchronously populates data from Shotgun.  Was wondering if anyone had any other cool ideas to use Shotgun with Nuke.

 

-Romey

13 comments

  • 0
    Avatar
    Gavin Greenwalt

    We have an internal feature idea to create a read node based on

     

    Project -> Sequence -> Shot -> Element -> Version

    Which the user can run an "update" check to see if any read nodes are out of date.   We haven't started yet.  Right now we're still working on getting Deadline to create new versions as a learning exercise.

    I would love to hear any ideas as well, as well as maybe collaborate on gizmo and python ideas in order to avoid overlapping efforts.

  • 0
    Avatar
    Jeff Klug

    Just started on this. (as a python n00b)  my progress so far:

    cp shotgun_api3_preview.py /apps/Nuke5.1v6/lib/python2.5

    in nuke script editor:

    from shotgun_api3_preview import Shotgun
    # Result:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/mnt/xraid2/apps64/Nuke5.1v6/lib/python2.5/shotgun_api3_preview.py", line 90, in <module>
        import urllib2
      File "/mnt/xraid2/apps64/Nuke5.1v6/lib/python2.5/urllib2.py", line 88, in <module>
        import hashlib
      File "/mnt/xraid2/apps64/Nuke5.1v6/lib/python2.5/hashlib.py", line 133, in <module>
        md5 = __get_builtin_constructor('md5')
      File "/mnt/xraid2/apps64/Nuke5.1v6/lib/python2.5/hashlib.py", line 60, in __get_builtin_constructor
        import _md5
    ImportError: No module named _md5

    hmm.  after some poking around, I figured I'd try replacing the nuke installed hashlib.so with my sytem's version.  (Nuke 5.1v6 seems to use python 2.5.1, and the one on my openSuse 11 system is python 2.5.2)


    cd /apps/Nuke5.1v6/lib/python2.5/lib-dynload
    mv _hashlib.so _hashlib.so.default
    cp /usr/lib64/python2.5/lib-dynload/_hashlib.so .

    in nuke script editor:

    from shotgun_api3_preview import Shotgun
    # Result:

    ok.  good.

    now let's try to actually do something:

    from shotgun_api3_preview import Shotgun

    SERVER_PATH = 'https://SECRETSUBDOMAIN.shotgunstudio.com'
    SCRIPT_USER = 'SECRETUSER'    
    SCRIPT_KEY = 'SECRETKEY'

    sg = Shotgun(SERVER_PATH, SCRIPT_USER, SCRIPT_KEY)

    project = sg.find_one("Project", [["name", "is", "Demo Project" ]])
    print project

    # Result: Traceback (most recent call last):
      File "<string>", line 8, in <module>
      File "/mnt/xraid2/apps64/Nuke5.1v6/lib/python2.5/shotgun_api3_preview.py", line 279, in find_one
        result = self.find(entity_type, filters, fields, order, filter_operator, 1)
      File "/mnt/xraid2/apps64/Nuke5.1v6/lib/python2.5/shotgun_api3_preview.py", line 253, in find
        resp = self._api3.read(req)
      File "/mnt/xraid2/apps64/Nuke5.1v6/lib/python2.5/shotgun_api3_preview.py", line 445, in callable
        return self.meta_caller(attr, *args, **kwargs)
      File "/mnt/xraid2/apps64/Nuke5.1v6/lib/python2.5/shotgun_api3_preview.py", line 452, in meta_caller
        (self.__class__.__name__, attr, self.__class__.__name__)
      File "<string>", line 1, in <module>
      File "/mnt/xraid2/apps64/Nuke5.1v6/lib/python2.5/shotgun_api3_preview.py", line 1741, in __call__
        return self.__send(self.__name, args)
      File "/mnt/xraid2/apps64/Nuke5.1v6/lib/python2.5/shotgun_api3_preview.py", line 2052, in __request
        verbose=self.__verbose
      File "/mnt/xraid2/apps64/Nuke5.1v6/lib/python2.5/shotgun_api3_preview.py", line 1771, in request
        h = self.make_connection(host)
      File "/mnt/xraid2/apps64/Nuke5.1v6/lib/python2.5/shotgun_api3_preview.py", line 1954, in make_connection
        "your version of httplib doesn't support HTTPS"
    NotImplementedError: your version of httplib doesn't support HTTPS

    damn.   now how to get ssl support into nuke's python?

     

    JK

  • 0
    Avatar
    Jeff Klug

    tried this:

    nuke -t

    Nuke 5.1v6, 64 bit, built Jul  7 2009.
    Copyright (C) 2008 The Foundry Visionmongers Ltd.  All Rights Reserved.
    Python 2.5.1 (r251:6028:6057M, Mar 14 2008, 16:54:54)
    [GCC 3.4.6 20060404 (Red Hat 3.4.6-8)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import _ssl
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ImportError: libssl.so.4: cannot open shared object file: No such file or directory
    >>>

    I see.

    jeff@zp07:/usr/lib64> cd /usr/lib64/
    jeff@zp07:/usr/lib64> ls libssl*
    libssl3.so  libssl.a  libssl.so  libssl.so.0.9.8
    jeff@zp07:/usr/lib64> sudo ln -s libssl.so.0.9.8 libssl.so.4
    jeff@zp07:/usr/lib64>

    try again:

    nuke -t

    Nuke 5.1v6, 64 bit, built Jul  7 2009.
    Copyright (C) 2008 The Foundry Visionmongers Ltd.  All Rights Reserved.
    Python 2.5.1 (r251:6028:6057M, Mar 14 2008, 16:54:54)
    [GCC 3.4.6 20060404 (Red Hat 3.4.6-8)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import _ssl
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ImportError: libcrypto.so.4: cannot open shared object file: No such file or directory
    >>>

    and another.

    jeff@zp07:/usr/lib64> ls libcrypt*
    libcrypt.a  libcrypto.a  libcrypto.so  libcrypto.so.0.9.8  libcrypt.so
    jeff@zp07:/usr/lib64> sudo ln -s libcrypto.so.0.9.8 libcrypto.so.4
    jeff@zp07:/usr/lib64>

    another try:

    nuke -t

    Nuke 5.1v6, 64 bit, built Jul  7 2009.
    Copyright (C) 2008 The Foundry Visionmongers Ltd.  All Rights Reserved.
    Python 2.5.1 (r251:6028:6057M, Mar 14 2008, 16:54:54)
    [GCC 3.4.6 20060404 (Red Hat 3.4.6-8)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import _ssl
    >>>

    nice.

    >>> from shotgun_api3_preview import Shotgun

    SERVER_PATH = 'https://SECRETSUBDOMAIN.shotgunstudio.com'
    SCRIPT_USER = 'SECRETUSER'
    SCRIPT_KEY = 'SECRETKEY'
    sg = Shotgun(SERVER_PATH, SCRIPT_USER, SCRIPT_KEY)

    project = sg.find_one("Project", [["name", "is", "Demo Project" ]])
    print project
    >>> >>> >>> >>> >>> >>> >>> >>> {'type': 'Project', 'id': 4}
    >>>

    sweet!

  • 0
    Avatar
    Gavin Greenwalt

    Try Python 2.6


    It works fine here.

  • 0
    Avatar
    Gavin Greenwalt

    Also I just posted a beta version of my Read Node for nuke.  (tested in Nuke 5.1,2)

    I would love to see it further developed.  I probably won't have time to work on it again for a bit.

  • 0
    Avatar
    Gavin Greenwalt

    Oops. 

    http://www.vfxtalk.com/forum/shotgun-read-node-sg-integration-t21217.html?p=102756#post102756

    Forgot to add the link.  Sorry about the double post.

  • 0
    Avatar
    Jeff Klug

    nice, thanks.  I'll definitely have a look at your read node.

    As for python 2.6, I'm not sure how I'd get python to use an external python interpreter instead of the built-in one.

     

  • 0
    Avatar
    Mike Romey

    Try creating a script that works outside of nuke using python 2.6.  Call the python script with a os.system command or something.  If you need to get the data back into Nuke for somehting try creating a pickle file with the data your getting from the external python 2.6 then import the pickle an dyou should be good.  It's pretty straight forward.  We use pickles to move data around a lot of the time.

     

     

  • 0
    Avatar
    Isaac Reuben

    Just wanted to note that I just tried Nuke5.2v1 on OSX, and https connections seem to be supported by default now (so no need to mess with adding in .so files or calling out to the system version of python).  Woot!  Not sure what version of Nuke ssl was added in, or if it's available on all platforms currently.

  • 0
    Avatar
    brian leair

    On Fedora release 8 and Nuke version 5.2v2 I still get the exception "No module named _md5":

    e.g.

    nuke -t

    import shotgun

    Traceback (most recent call last):
      File "stdin", line 1, in <module>
      File "/tools/release/lib/python2.5/site-packages/shotgun.py", line 70, in <module>
        import urllib2
      File "/tools/apps/nuke/nuke_5.2v2_linux_64/lib/python2.5/urllib2.py", line 88, in <module>
        import hashlib
      File "/tools/apps/nuke/nuke_5.2v2_linux_64/lib/python2.5/hashlib.py", line 133, in <module>
        md5 = __get_builtin_constructor('md5')
      File "/tools/apps/nuke/nuke_5.2v2_linux_64/lib/python2.5/hashlib.py", line 60, in __get_builtin_constructor
        import _md5
    ImportError: No module named _md5

    I have solved this by adding

       /usr/lib64/python2.5/lib-dynload/

    to my PYTHONPATH before starting nuke. 

     

    I am curious what other people have done to resolve this.

     

    thanks,

    -brian

     

  • 0
    Avatar
    Antoine Marbach

    Dear all, 

    Sorry for this silly question, we are new on Shotgun:

    We would like to integrate in Nuke an export node, which creates a new version in Shotgun. 

    Is it possible to do it with our LITE subscription? Or should we go for the 89$ STUDIO version? Does API access for integration and automation have something to do with this?

    Many Thanks

    Best

    Antoine

  • 0
    Avatar
    Isaac Reuben

    Hey Antoine,

    Yes, this thread is talking about using the API in Nuke in order to create Versions in Shotgun, and API access is included in the Studio level accounts or above.

    Cheers,

    - Isaac

  • 0
    Avatar
    Kevin Sallee

    I have the same problem with module _md5.
    If i try changing hashlib.so, i get some strange errors.
    If I try to create links for libssl.so and libcrypto.so (version 1.0.0a), a simple call to import md5 makes nuke crash...

    Any insights anyone? 

Please sign in to leave a comment.