Select to view content in your preferred language

Exporting chart in arcopy Errno 13 permissions error

631
3
Jump to solution
01-25-2023 03:57 AM
ChelseaVSmith
New Contributor II

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 

Tags (4)
0 Kudos
1 Solution

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

try providing a full path to the output svg


... sort of retired...

View solution in original post

3 Replies
DanPatterson
MVP Esteemed Contributor

try providing a full path to the output svg


... sort of retired...
ChelseaVSmith
New Contributor II

Thank you that worked!

Do you know how I can export a chart to png instead of svg file?

0 Kudos
ChristopherAllen
Esri Contributor

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