Hi All,
I am trying to create a Python toolbox tool to export layers to PNG. I can get this to work fine in the Python window, but when I try to save this as a toolbox script and set the df_export_width and df_export_height settings as GetParameterAsText inputs the tool keeps crashing out when running from ArcToolbox.:
>>> import arcpy
... from arcpy import env
...
... dataFrame = arcpy.GetParameterAsText(0)
... outputPNG = arcpy.GetParameterAsText(1)
... dfWidth = arcpy.GetParameterAsText(2)
... dfHeight = arcpy.GetParameterAsText(3)
...
... mxd = arcpy.mapping.MapDocument("CURRENT")
... df = arcpy.mapping.ListDataFrames(mxd, dataFrame)[0]
... arcpy.mapping.ExportToPNG(mxd, outputPNG, df, df_export_width=dfWidth, df_export_height=dfHeight)
If I run the above but with...
... dfWidth = 1600
... dfHeight = 1200
...it works fine.
Any help would be much aprreciated.
Cheers, Rich