<div dir="ltr"><div><span style="font-family:courier new,monospace">Dear VTK users,<br><br></span></div><div><span style="font-family:courier new,monospace">I try to write a VTM file from a python script.<br></span></div><div><span style="font-family:courier new,monospace">I use an instance of vtkXMLMultiBlockDataWriter</span></div><div><span style="font-family:courier new,monospace">My code works on fine small data.<br></span></div><div><span style="font-family:courier new,monospace">However on large data, the result files are not valid and can not be imported in Paraview.<br></span></div><div><span style="font-family:courier new,monospace">Paraview complains about a VTU header file that is not valid: Error parsing XML in stream at line 1, column 7, byte index 7: not well-formed<br><br></span></div><div><span style="font-family:courier new,monospace">As the VTU file is large, the file can not be opened in a text-file software.<br></span></div><div><span style="font-family:courier new,monospace">A 'head' on the VTU file reveals the problem, and shows that the XML header are not correct.<br></span></div><div><span style="font-family:courier new,monospace">On my file, I got these lines (</span><span style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">head -5 file.vtu)</span><br><br> offset="369942984"?><br><VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian" compressor="vtkZLibDataCompressor"><br>  <UnstructuredGrid><br></span></div><div><span style="font-family:courier new,monospace"><br></span></div><div><span style="font-family:courier new,monospace">Obviously the first line is not valid<br></span></div><div><br><span style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">I corrected the header with<br>sed '1s/.*/<?xml version="1.0"?>/' file.vtu > newfile.vtu<br><br></span></span></div><div><span style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">However, I am afraid that my data are corrupted.<br><br></span></span></div><div><span style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">Is it a bug?<br>Any advice to fix?<br></span></span><span style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">Any advice to check my data are not corrupted?</span></span><br><br></span></span></div><div><span style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"><br>The bug occur with VTK 5.10 and VTK 6.1</span><br><br><br></span></div><div><span style="font-family:courier new,monospace">Here is basically the code I use to write a VTM file<br><br>import vtk<br>VTKMajorVersion = vtk.vtkVersion.GetVTKMajorVersion()<br><br>w = vtk.vtkXMLMultiBlockDataWriter()<br>w.SetByteOrderToLittleEndian()<br>w.SetIdTypeToInt64()<br>w.SetCompressorTypeToNone()<br>w.SetFileName(outputFilename)<br>if VTKMajorVersion <= 5:<br>    w.SetInput(rr)<br>else:<br>    w.SetInputData(rr)<br>w.Update()</span></div><div><div><span style="font-family:courier new,monospace"></span><br><div><div><span style="font-family:courier new,monospace">Guillaume Jacquenot<br></span></div></div></div></div></div>