0

import tank failing in deadline script

I'm trying to write a pre task script for deadline and its failing when importing tank - specifically:

pre task script "/studio/prelaunch.py": ImportError : cannot import name constants (FranticX.Scripting.PythonNetException)

File "none", line 21, in <module>

File "/path_to_tank/install/core/python/tank/__init__.py", line 31, in <module>

from .platform import constants

(Deadline.Plugins.RenderPluginException)

 

anyone else come across this? can't work out why - its finding the tank library fine...some sort of namespace clash?

I am sys.appending the tank path before doing import tank as currently our deadline isn't setup with tank in its python path - would that potentially cause some sort of issue?

code:

tankPath = '/path_to_tank/install/core/python'
sys.path.append(tankPath)
import tank

anyone done any coding for deadline using sgtk?

3 comments

  • 0
    Avatar
    Stu Aitken

    the code seems to work fine in a vaniila python shell...

  • 0
    Avatar
    Benoit Leveau

    Because of the way Deadline launches Python from mono with its own embedded environment, it's a pain to integrate with the rest of the pipeline. So if we need to communicate with Shotgun from a Deadline script, we'll usually have the Shotgun part in a separate script, that we will launch using subprocess or ProcessUtils.SpawnProcess...

    Because you can't replicate the Deadline environment in a python shell, there's no easy way to test your scripts apart from launching them in Deadline, so having your pipeline script as a separate launchable script also helps debugging, as you can use it directly as a command line tool.

    Benoit

     

  • 0
    Avatar
    Stu Aitken

    thank for the info Benoit

    makes sense - thought there was something a bit weird going on :)

    I'll look into the plugin shotgun integration they have setup as default a bit more closely - I found another work around for thing I was originally doing :-)

Please sign in to leave a comment.