Second one:
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.
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.
No I mean just go to the project config directory and start a shell:
cd path-to-config
./tank 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.
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
cd path-to-project
./tank folders
You can also create the folders for a specific task by id:
./tank Task "@1234" folders
This action registers the folders in the database.