Re: ignoring or replacing white lines in a diff

2016-01-15 Thread Peter Otten
Adriaan Renting wrote: > - print line, did remove the extra newlines, but didn't get rid of the > blank lines. You mean you found that import fileinput for line in fileinput.FileInput("test.xml", inplace=True): if line.strip(): print line, does not remove all blank lines? If the f

Re: ignoring or replacing white lines in a diff

2016-01-15 Thread Adriaan Renting
Thanks for the various people that provided help. Peter Otten provided me with a working solution: I had to split the "-I '^[[:space:]]*$'" into two commands. cmd = ["diff", "-w", "-I", r"^[[:space:]]*$", "./xml/%s.xml" % name, "test.xml"] p = subprocess.Popen(cmd, stdin=open(

Re: ignoring or replacing white lines in a diff

2016-01-14 Thread Peter Otten
Adriaan Renting wrote: > > Maybe someone here has a clue what is going wrong here? Any help is > appreciated. > > I'm writing a regression test for a module that generates XML. > > I'm using diff to compare the results with a pregenerated one from an > earlier version. > > I'm running into two

Re: ignoring or replacing white lines in a diff

2016-01-14 Thread Martin A. Brown
Hello Adriaan, >Maybe someone here has a clue what is going wrong here? Any help is >appreciated. Have you tried out this tool that does precisely what you need? to do yourself? https://pypi.python.org/pypi/xmldiff I can't vouch specifically for it, am simply a user, but I know that I hav

Re: ignoring or replacing white lines in a diff

2016-01-14 Thread Nathan Hilterbrand
On 01/14/2016 03:22 PM, Adriaan Renting wrote: Maybe someone here has a clue what is going wrong here? Any help is appreciated. I'm writing a regression test for a module that generates XML. I'm using diff to compare the results with a pregenerated one from an earlier version. I'm running in

Re: ignoring or replacing white lines in a diff

2016-01-14 Thread Zachary Ware
On Thu, Jan 14, 2016 at 2:22 PM, Adriaan Renting wrote: > Any suggestions? Instead of trying to make diff behave through subprocess, have a look at Python's difflib: https://docs.python.org/3/library/difflib.html In particular, I think `difflib.ndiff(first_list_of_strings, second_list_of_strings