Select to view content in your preferred language

ArcGIS API for Python Map Export Error

577
2
Jump to solution
04-13-2023 02:05 PM
UnsungHer0z
New Contributor II

I am creating a basic map following the instructions from the ArcGIS API for Python tutorial (see link below).

https://developers.arcgis.com/python/guide/part5-saving-updating-and-embedding-map-widget/

When using the export_to_html method I get a bad escape \u and I cannot export the map. Is there a resolution to this error? It seems to me this error is related to this stack overflow question:

https://stackoverflow.com/questions/54330673/how-to-fix-error-bad-escape-u-at-position-0

Code (replaced API key and file path):

 

 

gis = GIS(api_key='my key')
map1 = gis.map('USA')
map1.export_to_html('file path')

 

 

Error:

UnsungHer0z_0-1681419573018.png

Package Versions:

Python - 3.7.1

ArcGIS - 2.1.0.3

0 Kudos
1 Solution

Accepted Solutions
UnsungHer0z
New Contributor II

That did not solve the issue, but I did look again and it ended up being an error with the ipywidgets version. I updated to 7.7.5 (anything after version 8 causes more errors) and now it works. I can successfully export the map as an html file but now I am running into another issue where the map file is blank when I open it. Not sure if I should create another post or continue with this one for this issue.

View solution in original post

0 Kudos
2 Replies
DavidPike
MVP Frequent Contributor

Have you got any backlashes in your arguments?  Error seems to be related to them.  Maybe use a raw string for your filepath r'C:\Stuff\I Love GIS'

0 Kudos
UnsungHer0z
New Contributor II

That did not solve the issue, but I did look again and it ended up being an error with the ipywidgets version. I updated to 7.7.5 (anything after version 8 causes more errors) and now it works. I can successfully export the map as an html file but now I am running into another issue where the map file is blank when I open it. Not sure if I should create another post or continue with this one for this issue.

0 Kudos