Error while loading vtp file

Hey guys,
I have been getting an error recently, and I hope you can help.
I use a pvpython code to combine vtk files for different variables for different time steps to vtp files and then to a pvd file. I have been using the following code for a long time, and it was working fine.

import os
from time import time
from tkinter import Variable
#from shutil import copyfile
from paraview.simple import *
import concurrent.futures

dataDir = os.path.join('.','postProcessing','surfaces4')

def writePVD():
    f = open('timeSteps-4.pvd', 'w')
    f.write('<?xml version=\"1.0\"?>\n')
    f.write('<VTKFile type=\"Collection\" version=\"1.0\" byte_order=\"LittleEndian\" header_type=\"UInt64\" compressor=\"vtkLZMADataCompressor\">\n')
    f.write('\t<Collection>\n')
    listVTPFiles = [_ for _ in os.listdir(dataDir) if _.endswith('.vtp')]
    for file in listVTPFiles:
        time = float(file.split('_')[1][:-4])
        f.write('\t\t<DataSet timestep=\"'+ str(time) +'\"\t part=\"0\"\t file=\"' + os.path.join(dataDir, file) +'\"/>\n')
    f.write('\t</Collection>\n')
    f.write('</VTKFile>\n')
    f.close()
    print('timeSteps.pvd file written')

def processing(folder): 

    
    files = os.listdir(os.path.join(dataDir,folder))
    timeStamp= format(round(float(folder.split('/')[-1]),2), '0>8.2f')
    print(' --> processing time step', folder)
    vtkReader = []
    for file in files:
        vtkReader.append(LegacyVTKReader(FileNames=[os.path.join(dataDir, folder, file)]))

    appendAttributes1 = AppendAttributes(Input=vtkReader)

    fileName = os.path.join(dataDir,'time_'+timeStamp+'.vtp')
    SaveData(fileName, proxy=appendAttributes1, EncodeAppendedData=1, CompressorType='LZMA')
        
    #os.system('rm -r {}'.format(os.path.join(dataDir,folder)))

#dataDir = os.path.join('.','postProcessing-3','cuttingPlane')
timeDirs = [dI for dI in os.listdir(dataDir) if os.path.isdir(os.path.join(dataDir,dI))]
timeDirs.sort()
dataDirs = dataDir*len(timeDirs)
nCPUs = os.cpu_count()
# List of names of variables to be converted to PVD. Each PVD file will be dedicated for single variable

with concurrent.futures.ProcessPoolExecutor(max_workers=nCPUs) as exe:
    result = exe.map(processing, timeDirs)

writePVD()

print('TASK COMPLETED!')
exit()

recently, when I open the resulting pvd file it shows the error:

ERROR: In vtkXMLParser.cxx, line 379
vtkXMLDataParser (0x561eefc37760): Error parsing XML in stream at line 51, column 48, byte index 2933: not well-formed (invalid token)

ERROR: In vtkXMLReader.cxx, line 520
vtkXMLPolyDataReader (0x561eefd82160): Error parsing input file.  ReadXMLInformation aborting.

ERROR: In vtkExecutive.cxx, line 741
vtkCompositeDataPipeline (0x561eef7993f0): Algorithm vtkXMLPolyDataReader (0x561eefd82160) returned failure for request: vtkInformation (0x561eefca9990)
  Debug: Off
  Modified Time: 305315
  Reference Count: 1
  Registered Events: (none)
  Request: REQUEST_INFORMATION
  ALGORITHM_AFTER_FORWARD: 1
  FORWARD_DIRECTION: 0

I don’t know why this happens. I don’t think that my system admin has updated ParaView too.

Any ideas how to fix it?

I am using the following version of ParaView:

Client Information:
Version: 5.11.0
VTK Version: 9.2.20220823
Qt Version: 5.15.8
vtkIdType size: 64bits
Embedded Python: On
Python Library Version: 3.6.15 (default, Sep 23 2021, 15:41:43) [GCC]
Python Numpy Support: On
Python Numpy Version: 1.19.5
Python Matplotlib Support: On
Python Matplotlib Version: 2.2.5
Python Testing: Off

Regards.

This is the classic libexpat issue: https://bugs.launchpad.net/ubuntu/+source/paraview/+bug/2058415

Simplest fix is to use our binary release instead: https://paraview.org/download