I have a double interrogation about weird results and it might be the problem.
First One, I do this:
tk = sgtk.sgtk_from_path(path)
ctx = tk.context_from_path(path)
And than my ctx.task return None
If I do couple of python opération suh as saving, incrementing my work file scenes, i loose my contextand I have this error:
[ERROR tk-multi-workfiles2] Engine tk-houdini cannot initialize - the pick environment hook was not able to return an environment to use, given the context Step Model. Usually this is because the context contains insufficient information for an environment to be determined.
I think it’s because the api can’t find my task_name or because there is a mistake between my schema and my templates.yaml.
Honestly I don’t know what I can do to fix this.
Thanks for your attention
Your guesses are probably right. The two problems likely arise from the same cause. Most likely schema mismatch. There are ways to research this further in the tk shell.
Thanks for you time,
When you talk about tk-shell you mean the tk-shell.yml inside the folder “include” ?
Do have any idea how to fix it ?
No I mean just go to the project config directory and start a shell:
Which gives you an interactive shell to try stuff in. By using
tk.context_from_path and such you can figure out where it breaks.
For the same of course you can use the Python shell in Houdini.
So the context Step Model has no task? Is Model the Step in this case?
The most reliable way to diagnose this is to use a debugger such as
pdb. Put a breakpoint before
context_from_path and then step inside it, and observe the process step by step.
I tried with a default project project.
If you do a
context_from_path on a default project config, you have a ctx.task empty.
Technically it look normal because you have no information about task_name in the default template.yml.
I naivilly thought if I had the “task_name” in my “houdini_shot_work” key I would have my task in “sgtk_context_from_path”
But it should, if
task_name is in the template. We use this constantly.
This might also have to do with the “path cache” and the Filesystem entities - folders are registered in the database, marked with their corresponding entity.
This means that maybe you have to create the folders first, and then
context_from_path will work
You can also create the folders for a specific task by id:
./tank Task "@1234" folders
This action registers the folders in the database.
Ok So I checked differents technique.
And it shows that by default the project config doesn’t work with tk.context_from_path(path) because you don’t have a task folder.
It looks like there is a collision between schema and template.yml.
Thank for you time.