I would like to join a shapefile to a CSV file in PyQGIS 3.0. So, when I run the following code, it executes without errors but the join action does not succeed. What is wrong with the following code?
layer=iface.activeLayer()
lien_csv="D:/Ghaleb/Projet_SIG/PFE SIG/FICHIERS_SHP/Essai.csv"
infoLyr =QgsVectorLayer(lien_csv,'Table_CSV' , "ogr")
QgsProject.instance().addMapLayers([infoLyr])
infoLyr.isValid()`
info = QgsVectorLayerJoinInfo()
info.setJoinFieldName = "CLE_CSV"
info.setTargetFieldName = "CLE"
info.setJoinLayerId = infoLyr.id()
info.setUsingMemoryCache = True
info.setJoinLayer(infoLyr)
layer.addJoin(info)
lien_save="D:/Ghaleb/Projet_SIG/PFE SIG/FICHIERS_SHP/Vanne_Joint.shp"`
QgsVectorFileWriter.writeAsVectorFormat(layer,lien_save, "iso-8859-15",QgsCoordinateReferenceSystem(32632, QgsCoordinateReferenceSystem.EpsgCrsId), "ESRI Shapefile")
joinedLyr = QgsVectorLayer(lien_save, 'Joined' ,"ogr")
QgsProject.instance().addMapLayers([joinedLyr])