[PYTHON] - close batch

[PYTHON] - close batch

Anonymous
Not applicable
1,212 Views
4 Replies
Message 1 of 5

[PYTHON] - close batch

Anonymous
Not applicable

Hi guys, 

 

I created a script to generate automatically batchs from a list of shot but when I don't manage to close my batch after creation. 

 

flame.batch.close()

This return me : RuntimeError: Cannot close the active Batch Group.

Is there a way to close batch after creation or to force it with this line ? 

Thanks again,

Anthony

0 Likes
Accepted solutions (1)
1,213 Views
4 Replies
Replies (4)
Message 2 of 5

fred.warren
Autodesk
Autodesk

Hello Anthony,

 

It is not possible to close all the Batch Groups from the Desktop. There must always be at least one loaded in the application memory.

 

The solution would be to keep an empty Batch Group and keep this one in memory while you close all the ones you have created.

 

Please accept this as a solution if you feel that your question has been answered.

 

fred


Frédéric Warren
User Experience Designer
0 Likes
Message 3 of 5

Anonymous
Not applicable

Hi Fred,

 

Thanks for your answer !
If at least only one was opened it would be perfect for me ! But actualy all batchs are opened.
How can I close every batch except one ? Is there a name parameter on the flame.batch.close() function ?


Thanks,

0 Likes
Message 4 of 5

fred.warren
Autodesk
Autodesk
Accepted solution

You could try the following loop that is not stopped when it comes across an exception:

 

for bg in flame.project.current_project.current_workspace.desktop.batch_groups:

   try:

      bg.close()

   expect Exception, e:

      print str(e)


Frédéric Warren
User Experience Designer
0 Likes
Message 5 of 5

Anonymous
Not applicable

Thanks Fred !

0 Likes