Hello, I really hope someone can help me. I have been using the same code to export map series for some weeks and today I'm getting an error telling me that my syntax is invalid when exporting ms.
p = arcpy.mp.ArcGISProject("Current")
l = p.listLayouts()[2]
if not l.mapSeries is None:
ms = l.mapSeries
if ms.enabled:
ms = l.mapSeries
indexLyr = ms.indexLayer
arcpy.SelectLayerByAttribute_management(indexLyr, "NEW_SELECTION", "SA = 19 and AMA = 'A'")
print("Exporting SA{} AMA-{}".format(currentSA, currentAMA)
ms.exportToPDF(relpath + "\P19_MapAtlas_FGD_SA19_AMA-A_SCR.pdf", "SELECTED")
File "<string>", line 12
ms.exportToPDF(relpath + "\P19_MapAtlas_FGD_SA19_AMA-A_SCR.pdf", "SELECTED")
^
SyntaxError: invalid syntax
Why is my ms not valid? I've individually checked that each variable is pointing to the correct feature and I've tested the SelectLayerByAttribute as well, working great. It just does not want to export... Any ideas??