Agreed and for a few years now that's what I have done. But for detailed, log/debug driven sequence diagrams that often required parsing a log, generating a compliant text-input to the tools followed by submitting to the tool and exporting the graphic. This 30-minute project is a step in the direction to fully automate the process.
What value are you encountering for list 'D' when you get the error? As you can see from the code, not really production-grade coding and certainly not heavily tested, proof-of-concept more than anything else.