Python example listener - tags not supported

The Python example listener (CsvResultListener.py) doesn’t seem to support tags (e.g. <Date>) or metadata tags (e.g. DUT’s <ID>) in the File Path. I’m guessing that the example code just needs some additional statements to make this information available. Any suggestions as to what needs to be added/changed in the example code to allow this?

Using PyCSV as the listener and File Path: Results/<Date>-test.csv
I get this error:

07:31:40.804 PyCSV Traceback (most recent call last):
07:31:40.804 PyCSV
07:31:40.804 PyCSV File “C:\Program Files\OpenTAP\Packages\PythonExamples\CsvResultListener.py”, line 50, in OnTestPlanRunCompleted
System.IO.File.WriteAllText(self.FilePath, self.sb.ToString())
07:31:40.804 PyCSV
07:31:40.804 PyCSV System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
at System.IO.Path.GetFileName(String path)
at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)
at System.IO.StreamWriter…ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost)
07:31:40.804 PyCSV
07:31:40.804 PyCSV OnTestPlanRunCompleted for PyCSV. [6.90 ms]

Note: the same File Path works correctly when using the built in CSV listener

Thanks,

The tags are not currently supported by the example code. This is mostly to avoid overcomplicating it.

However, if everyone making a ResultListener plugin would need that anyway, maybe it would be natural to add it.

I have made a PR which changes it to using MacroString. Please let me know what you think.

Hi Rolf,

Works as expected - thanks for the prompt reply and support.
Much appreciated