I am relatively new to PyQGIS and am attempting to save a SpatialLite layer into a new layer (preferably in the same database) with a different CRS (I had it working in shapefile but have had to move the data to SpatialLite which I have not used before). I keep on getting errors about the types of my variables, but am unable to figure out how else to do it and I can't find an example online which says what each of the variables are when exporting to SQLite.
layers = QgsProject.instance().mapLayersByName('SiteCard_AMG') layer = QgsVectorLayer(layers.dataProvider().dataSourceUri(), '', 'ogr') crs=QgsCoordinateReferenceSystem("epsg:4326") error = QgsVectorFileWriter.writeAsVectorFormat(layer, 'C:\\Users\\Megan\\Documents\\new.sqlite', 'utf-8', crs, 'SQLite', False, None, ['SPATIALITE=YES'])
error as follows;
Traceback (most recent call last): File "C:\PROGRA~1\QGIS3~1.10\apps\Python37\lib\code.py", line 90, in runcode exec(code, self.locals) File "<input>", line 1, in <module> File "<string>", line 47, in <module> TypeError: QgsVectorFileWriter.writeAsVectorFormat(): arguments did not match any overloaded call: overload 1: argument 7 has unexpected type 'NoneType' overload 2: argument 4 has unexpected type 'QgsCoordinateReferenceSystem' overload 3: argument 3 has unexpected type 'str'