AnsweredAssumed Answered

ExportToPNG error

Question asked by jwa_ofc@bellsouth.net on Feb 14, 2018
Latest reply on Feb 15, 2018 by jwa_ofc@bellsouth.net

I have this code, which is basically copied from the online help:

 

import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
arcpy.mapping.ExportToPNG(mxd, r"D:\t.png")

 

It generates this error:

Runtime error 
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\utils.py", line 182, in fn_
return fn(*args, **kw)
File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\mapping.py", line 1228, in ExportToPNG
layout.exportToPNG(*args)
File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\utils.py", line 182, in fn_
return fn(*args, **kw)
File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\arcobjects\mixins.py", line 586, in exportToPNG
return self._arc_object.exportToPNG(*args)
AttributeError: PageLayoutObject: Error in parsing arguments for ExportToPNG

 

Exporting the map using file, export, works fine. I tried making the path on C: and that fails too. I tried using exportToJPEG and got the same sort of error.

Outcomes