That explains why setting some of the options in the code does not produce the expected result, for instance setting
bDryRun = True # write the commands to a text file instead of the serial port
does not redirect the output but causes the extension to fail.
Does the original code (from before it was stripped) still exist?
Would be nice to have the option to write to a file in order to make multiple identical plots later using the command line.