'NoneType' object is not subscriptable

User avatar
JCB91
Fusioneer
Posts: 73
Joined: Thu Mar 10, 2016 1:46 am

'NoneType' object is not subscriptable

#1

Post by JCB91 » Wed Aug 08, 2018 5:51 am

I have a python module for importing node tree templates.
It opens a Template and copy pastes all nodes to another flow.
At the moment it tries to select the flow of the template comp it fails
  1. def importNodeTreeTemplate(current_comp, template_path):
  2.     print(template_path)
  3.     template_comp = fusion.LoadComp(template_path)
  4.     template_comp.Lock()   
  5.  
  6.     template_tools = template_comp.GetToolList(False)
  7.  
  8.     print(len(template_tools))
  9.     print(template_tools)
  10.     for i in range(len(template_tools)):
  11.         print(i+1)
  12.         print(template_tools[i+1])
  13.         print(template_comp)
  14.         flow = template_comp["CurrentFrame"]["FlowView"]
  15.         flow.Select(template_tools[i+1])
  16.        

flow = template_comp["CurrentFrame"]["FlowView"]
TypeError: 'NoneType' object is not subscriptable




In Fu7 the same script works perfect. Any ideas?

Also running this direct in Fu9 console works nice:
  1. template_comp = fusion.LoadComp('EXAMPLE.comp')
  2.  
  3. template_comp.Lock()
  4.    
  5. print(template_comp)
  6.  
  7. template_tools = template_comp.GetToolList(False)
  8.  
  9. print(len(template_tools))
  10. for i in range(len(template_tools)):
  11.    
  12.     print(i+1)
  13.    
  14.     template_comp["CurrentFrame"]["FlowView"].Select(template_tools[i+1])
  15.        
  16. template_comp.Copy()
  17. template_comp["CurrentFrame"]["FlowView"].Select()
  18.