I am trying to use the 'merge vector layers' tool in PyQGIS to merge all of the layers in my QGIS project into one shapefile, as part of a larger script I am developing. I tried this script, but I get an error related to the input layers. I am using QGIS 3.0.0.
processing.algorithmHelp('native:mergevectorlayers')
input = iface.mapCanvas().layers()
processing.run('native:mergevectorlayers',{'LAYERS':input,'CRS':4326,'OUTPUT':'C:\Users\hp\Desktop\COOPI\GIS_Data\CWW_Predictive_Targeting\GEOREF_HH_GPS_Data\Shapefiles\Merged\TA_Mponda_GVH_Bolera_malunga.shp'})
This is the error I get:
Traceback (most recent call last):
File "C:\OSGEO4~1\apps\Python36\lib\code.py", line 64, in runsource
code = self.compile(source, filename, symbol)
File "C:\OSGEO4~1\apps\Python36\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\OSGEO4~1\apps\Python36\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\OSGEO4~1\apps\Python36\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\OSGEO4~1\apps\Python36\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape