I'd like to output a series of dircmp report_full_disclosure()'s to a text file. However the report_full_disclosure() format is one blob of text, it doesn't play nicely with file.write(comparison_object.report_full_disclosure()) because file.write() expects a single line to write to the file.
I've tried iterating through the report_full_disclosure() report but it doesn't work either. Has anyone else had this particular problem before? Is there a different method to write out to files?
the "report generating" methods of dircmp.filecmp don't accept a file object, they just use the print statement (or, in the Python 3 version, the print() function)
You could create a subclass of dircmp.filecmp which accepts a file argument to methods report, report_full_closure and report_partial_closure (if needed), at each print ... site writing print >>dest, ....  Where report_*_closure call recursively, pass the dest argument down to the recursive call.
The lack of ability to print output to a specific file seems to me to be an oversight, so having added an optional file argument to these methods and tested it thoroughly you may wish to offer your contribution to the Python project.
If your program is single threaded, you could temporarily replace sys.stdout with your destination file before calling the report methods.  But this is a dirty and fragile method, and it is probably foolish to imagine your program will be forever single threaded.
How do write filecmp's report_full_disclosure() to a text file?