Q:

ExportToJPEG - can't change resolution, always resets to default

In ArcGIS Pro (latest version), using the ExportToJPEG (or even ExportToPNG) arcpy function, I can't seem to export an image with my desired resolution. It always defaults to 96 dpi even when I specify 500. What am I doing wrong? Is this a bug?
This is the script I paste into the python console within ArcGIS Pro:
p = arcpy.mp.ArcGISProject("CURRENT")
print ("project loaded")
l = p.listLayouts("MyLayout")[0]
print ("layouts listed")
if not l.mapSeries is None:
 ms = l.mapSeries
 if ms.enabled:
   for pageNum in range(1, ms.pageCount + 1):
     ms.currentPageNumber = pageNum
     print("Exporting page {0} of {1}".format(str(ms.currentPageNumber), str(ms.pageCount)))
     l.exportToJPEG(r"C:\\Users\\Theo\\Dropbox\\site_plans\\Current_GR_site_plans\\GR2-GroundMovement-SP-_{0}".format(str(ms.currentPageNumber) + ".jpg", 500))

You can see at the end I specify 500 as the resolution. Even when I write- resolution = 500, it's the same. My images aren't coming out in my desired quality.
If I export a single page using the share ribbon, setting the dpi to 500, it works. But I'm automating this, so that's not a viable option for me.
Guides I've used:
https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fpro.arcgis.com%2Fen%2Fpro-app%2Farcpy%2Fmapping%2Fmapframe-class.htm
https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fpro.arcgis.com%2Fen%2Fpro-app%2Farcpy%2Fmapping%2Flayout-class.htm
similar issue to:
https://community.esri.com/thread/201455-exporttojpeg-resolution-problem
ExportToJPEG() arcpy script failure
(ArcMap)
neither helped me.

A:

Syntax error, found on official ESRI website (they have been informed).
Essentially, the last line has a closing bracket out of place. The line SHOULD read:
l.exportToJPEG(r"C:\\Users\\Theo\\Dropbox\\site_plans\\Current_GR_site_plans\\GR2-GroundMovement-SP-_{0}".format(str(ms.currentPageNumber)) + ".jpg", 500)

