One of the sbs files that I am writing automation code for throws an error when I attempt to save it. I have reduced my code to simply opening & saving the file and the error persists, implying something is wrong with the sbs file.
For example, running this:
sbsDoc = substance.SBSDocument(aContext, sbsfile)
sbsDoc.parseDoc()
sbsDoc.writeDoc()
Results in a 160+ line traceback error that loops through the same 4 modules in pysbs. Below is the end of it. ([toolsdir] does not appear in the traceback, that is my edit)
File "[toolsdir]\python\3.7\Lib\site-packages\pysbs\sbscommon\values.py", line 625, in write
aSBSWriter.writeSBSNode(aXmlNode, element, 'treelist')
File "[toolsdir]\python\3.7\Lib\site-packages\pysbs\api_decorators.py", line 54, in wrapper
return function(*args, **kwargs)
File "[toolsdir]\python\3.7\Lib\site-packages\pysbs\sbswriter.py", line 90, in writeSBSNode
aSBSObject.write(self, aNewNode)
File "[toolsdir]\python\3.7\Lib\site-packages\pysbs\api_decorators.py", line 54, in wrapper
return function(*args, **kwargs)
File "[toolsdir]\python\3.7\Lib\site-packages\pysbs\sbscommon\values.py", line 569, in write
for element in self.mElements:
TypeError: 'NoneType' object is not iterable
It's like the class SBSTreelist in values.py gets handed a bunch of empty data and cannot handle it.
As I mentioned I think something is wrong with the sbs, but I'm unsure what to look at. What's stranger is that running the command line tools, such as sbsmutator, have no problem editing the file. It's just pysbs that has an issue. Any advice or wild guesses are appreciated!