Context task - None

Hi guys,
I have one small issue.
(In Maya) when I print context.task then it is empty “None”, but when I try other layout file - from a different step/task, then it shows up the context.task details. Do you know where could be a problem?

  • Also what I found is that I can print context.task details when I do Open > Layout > new file, but when I save the file > File Save then the context.task is None

Thanks.

4 Likes

Hey Lukas

Welcome to the forums, thanks for posting here.

If you open a pre-saved file via the Shotgun open app, is the Task present in the context then?
And then once you save it do you lose the context?

It sounds to me like your probably losing context due to the automatic context switching. You can switch that off, but it will mean that the context won’t change automatically if the user opens a file via method other than the open app.
Could you try switching it off as a test just to confirm that the context does not lose the task?

To disable it you would add automatic_context_switch: False to all the settings blocks in this file.

Best
Phil

3 Likes

Hi Phil,

that option didn’t work. :frowning:

If you open a pre-saved file via the Shotgun open app, is the Task present in the context then?

No

And then once you save it do you lose the context? Yes.

But when I print context.step or context.user, then I get details from them, but still not from context.task

One more thing. I have realized, that if I try to create an another shot in shotgun, then the new shot from SG is fine. So I guess, if something is wrong with SG shot in the web - the original one. - maybe setting? But I checked out everything and it seems to be same. :confused:

Any other idea where could be a problem?

Thanks

Lukas

1 Like

Interesting. Can you try unregistering the folders for one of the Shots that doesn’t work, and then running the folder creation for it again, and seeing if that helps?

3 Likes

And don’t forget to do a tank synchronize_folders --full

2 Likes

Hi Philip and Patrick,
yes unregistering the folders and creating folder again worked and fixed the issue. Many thanks.
Do you know how this issue happened?

Thanks.

2 Likes

The context task is derived from the path-cache, so if that’s broken, then you’ll have context issues.

1 Like

oh you mean how did your path-cache get broken? Likely that someone renamed a shot/sequence/task after the folders had been created . (Deleting the entity and creating a new one with the same name also causes issuses)

3 Likes

Hi guys,
I have the issue again. But now unregistering and creating folders of a shot does not work. (does not help).
We have an audio path with audio task.
I am trying to get a task from:
get_ctx = tk.context_from_path(audio_path)
get_ctx.task

it prints None

I did check the file path, sg web and it seems that it is ok.
any ideas, what could be wrong?

Thanks

1 Like

Hi Lukas – Sorry to hear this is happening again! I’ve replied to the ticket you sent, as I may need to get some of your configuration data from you. I’ll post an update here once it’s resolved.

1 Like

Hi @lukasb,

We were you able to identify what was causing the issue?

We randomly started having this issue on some assets where context.task returns None.

It appears that the unregister and re-registering the folders fix the issue, but I’m wondering what caused the issue and if there is a better way to fix the issue.

Thanks a lot in advance

1 Like

We figured out what was causing the issue.

One of the pipeline step’s name was change and that was causing the paths not to resolve correctly. We reverted the pipeline step’s name back and everything is back to normal.

It was not easy to find, so I hope it worn’t happen to anyone else.

Cheers

2 Likes