Hi I'm using ArcPro 3.0. and using arcpy to export a chart following on from a script used to produce scores at the start of the script I have set the environment. However, when I try to export chart to SVG I get a Permissions error that I can't find any guidance on. Any help much appreciated.
c = arcpy.Chart('bar_final_scores')
c.type = 'bar'
c.title = "Final HBRA Scores for AU"
c.xAxis.field = 'Criteria'
c.xAxis.title= "Criteria"
c.yAxis.field = 'Score'
c.yAxis.title = "Score"
c.bar.aggregation = ''
c.dataSource = 'AUFinal'
c.exportToSVG('bar_final_scores.svg')
Traceback (most recent call last):
File "<string>", line 12, in <module>
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\charts.py", line 448, in exportToSVG
with _codecs.open(path, "w", "utf-8") as f_svg:
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\codecs.py", line 905, in open
file = builtins.open(filename, mode, buffering)
PermissionError: [Errno 13] Permission denied: 'bar_final_scores.svg'
Best,
Chelsea
Solved! Go to Solution.
try providing a full path to the output svg
Thank you that worked!
Do you know how I can export a chart to png instead of svg file?
Hi @ChelseaVSmith ,
Unfortunately, it's currently only possible to export a chart in SVG format from Python (though you can also export in PNG or JPG formats from the UI). We hope to add Python support for PNG and JPG in the near term.
Thanks,
Chris