Can someone please help me with the migration of this code? It is used 
to export hundreds of maps and did its job perfectly.


        >>> import_path = r"P:\project.mxd"   # Path of .mxd
    export_path = r"P:\"   # Path of output file
    field_name = "Taxon" # Name of field used to sort DDP
    
    ... mxd = arcpy.mapping.MapDocument(import_path) 
    ... for i in range(1, mxd.dataDrivenPages.pageCount + 1):
    ...    mxd.dataDrivenPages.currentPageID = i
    ...    row = mxd.dataDrivenPages.pageRow
    ...    print row.getValue(field_name)
    ...    arcpy.mapping.ExportToJPEG(mxd, export_path + "." + row.getValue(field_name) + ".jpg",resolution=600) 
    ... del mxd


Thank you,
Phil

---

This is the error message i get:

> SyntaxError                               Traceback (most recent call
> last) File C:\Program
> Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\ast.py, in parse:
> Line 50:    return compile(source, filename, mode, flags,
> 
> SyntaxError: invalid syntax (<string>, line 9)