TankInitError: You are loading the Toolkit platform from the pipeline configuration located in ‘C:\Users\Craig\AppData\Roaming\Shotgun\machine\site.basic.desktop\cfg’, with Shotgun id None. You are trying to initialize Toolkit from C:\MasterProjects\test_dev_01, however that is not associated with the pipeline configuration. Instead, it’s associated with the following configurations: ‘None’ (Pipeline config id 1, Project id 243), ‘None’ (Pipeline config id 3, Project id 243), ‘None’ (Pipeline config id 4, Project id None), ‘None’ (Pipeline config id 5, Project id None), ‘None’ (Pipeline config id 39, Project id None), ‘None’ (Pipeline config id 40, Project id None), ‘None’ (Pipeline config id 41, Project id None), ‘None’ (Pipeline config id 42, Project id None), ‘None’ (Pipeline config id 78, Project id None).
It appears I need additional code to associate a specific configuration. Any insights on the minimal code to start an engine are appreciated.
As the error states, you’ll need to have the engine that you want to initialize defined in the context in which you want it to run. So, I guess the question here is what are you passing as the value of ctx?
As a side note, I’m not sure of your use case, but you might want to consider the Bootstrap API, as it’s designed for exactly what you’re mentioning. The code snippet here is a good start.
Let us know if you have any questions as you go along.
I’m writing a guide at the moment on bootstrapping which is now going into review. It’s not quite ready for a full public release but I’ve sent you a private message with a link to a preview build.
The plugin id itself, doesn’t matter a great deal, it’s kind of an arbitrary value, and it will create a cached config on disk in a folder named after the plugin id. It also does a few other things, but for your purpose I would probably just go with a value of basic.adobe since that is what the standard aftereffects launch process would register it as.
The bootstrap guide is great, thanks. The only addition to the guide might be an addendum listing the fact that basic.adobe is used for the After Effects (and Photoshop?) plugin, as I haven’t seen that documented anywhere. Or simply list every application and the corresponding plugin name.
I was able to bootstrap After Effects using the guide. After the bootstrap, it would not print out any info. For example, this wouldn’t print:
pprint.pprint(engine.commands.keys())
And the engine seemed to “hang”. However, for now this answers my question and I don’t have to use the bootstrap, so I consider this resolved. Thanks, again…
Sorry, I think there may have been a bit of misunderstanding on my part here, I don’t think I fully appreciated what you were asking which was my fault.
You can bootstrap the tk-shell engine and then launch Aftereffects via engine.execute_command("after_effects_cc_2019",[]), which will start aftereffects up.
But I think bootstrapping the After Effects engine specifically would be tricky.
Each engine will only bootstrap in the software it was designed for. The After Effects engine doesn’t know how to operate without After Effects being present.
The After Effects and Photoshop engines are probably not easy to bootstrap manually even in After Effects because those applications don’t support Python natively, so when we launch them in Toolkit, we ensure that the Toolkit plugin is installed and that a separate Python instance is initiated which then communicates to the plugin.
With something like Maya for example, you can launch Maya without the Shotgun integrations, and then run the bootstrap code from within Maya and the integrations/Shotgun menu will start.
Thanks, Philip. Yes, this all makes sense regarding After Effects and Photoshop, as they use an ECMA/Javascript “variation” for the API and Toolkit uses RPC to communicate with the API.
Likewise, I understand now that bootstrap code for an application like Maya would need to be started from within the application. Overall, my original view regarding minimal code to start an engine was uninformed. I think I see the picture clearer now.
Again, the bootstrap guide is great with tk-shell. Thanks again, Philip, for your time in clearing all this up.