I want to export the PostGIS layer as a shapefile. I need to use replace all selected raw field values with displayed values in QGIS. To do so, I follow PyQGIS Export table with Replace all selected raw field values by displayed values option. But my QGIS crashed.
I found the problem in this line (options.fieldValueConverter = QgsVectorFileWriter.FieldValueConverter()
). I do not know what is the reason for this crashing.
This is my complete code.
options = QgsVectorFileWriter.SaveVectorOptions()
options.driverName = 'GPKG'
options.fileEncoding = 'utf-8'
options.fieldValueConverter = QgsVectorFileWriter.FieldValueConverter()
QgsVectorFileWriter.writeAsVectorFormat(layer, output_file_name, options)
Can anyone help me what is the problem?