Newbie: help running sgtk module in python

Hi! I’m doing some Python/shotgun consulting. I’m pretty much a newb at Shotgun, though I know a lot of Python. As part of this, I’m using the shotgun API (https://developer.shotgunsoftware.com/python-api/reference.html) to talk to Shotgun from python (3.7), and that’s working fine, but it seems that for certain things I also need to use sgtk. I tried pointing my python/pip to the latest release on github, but when I do sgtk.sgtk_from_entity('Project', project['id']) using that I get a runtime error

**tank.util.errors.UnresolvableCoreConfigurationError: 
Cannot resolve the core configuration from the location of the Sgtk Code! 
This can happen if you try to move or symlink the Sgtk API. 
The Sgtk API is currently picked up from /Users/garyo/Library/Caches/.../src/sgtk/python/tank 
which is an invalid location.**

How can I fix that?

1 Like

Hi Gary –

Welcome to the forums, and welcome to the rich world of Shotgun Toolkit :blush:

Toolkit is Shotgun’s platform for building pipelines, and sgtk is the Toolkit core API. They rely on having a Toolkit pipeline configuration for your project. When you run sgtk_from_entity(), it queries Shotgun for the entity’s associated pipeline configuration (as documented here).

We have a couple step by step guides on specific dev tasks with the Toolkit API: one on generating a path and then publishing it, and one on bootstrapping a Toolkit engine and launching an app. The early steps in both of these should be useful in understanding how to initialize the Toolkit core API.

If there’s something specific you’re trying to achieve via sgtk, maybe we can lead you further down the right path with more information.

1 Like