[p4python] line splitting problem

Eric Huss e-huss at netmeridian.com
Fri Apr 27 09:52:34 PDT 2007


I ran into a problem with the way that p4python splits output lines.  I
was trying to use run_print() to slurp the contents of a file from the
depot, but because of the way the lines are split in OutputText, I ended
up with the equivalent of empty lines in the output.  Perforce seems to
send over the text in batches, so it ended up sending something like:

'line1\nline2\nline3\n'
'line4\nline5\nline6\n'

This resulted in output being set to:

['line1', 'line2', 'line3', '', 'line4', 'line5', 'line6', '']

Thus, you cannot use '\n'.join(output) to reconstruct the original file.

I ended up overriding P4ClientHandler to not split lines, but it would be
nice for a more official fix.

-Eric



More information about the p4python mailing list