Python Script attribute error while using node editor
probably this material has been created for the blender render engine (by default nodes are disabled ) so you just have to enable using nodes before accessing the node tree by the following line : mat.use_nodes = True then you'll have access to the node tree, you can do a test before accessing to avoid getting into errors