Select to view content in your preferred language

Missing exercise data for Visualizing Data Using ArcGIS API for Python

06-03-2022 12:38 PM
New Contributor

Hello, I am working my way through the Visualizing Data Using ArcGIS API for Python course, and downloaded the required sample data. I am watching the first video in which a shapefile for Liberia airports is mentioned, however I do not see that in the folder I downloaded. I am working with the python notebooks built in to ArcGIS Pro and got the error below when I tried to run the code. I am just starting out with using the ArcGIS pro api and I am not exactly sure what the error means. Thank you in advance for any help!

sedf = pd.DataFrame.spatial.from_featureclass('[the rest of my file path]\VisualPythonAPI\Liberia_Airports.shp')
SyntaxError                               Traceback (most recent call last)
File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\, in parse:
Line 35:    return compile(source, filename, mode, PyCF_ONLY_AST)

SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape (<string>, line 1)
0 Kudos
1 Reply
Occasional Contributor III

Hi @marciehogan 

The error is because you are using \ in your filepath. This is a special escape character in Python. You either need to place r in front of your filepath outside the string quotation, use double \\, or use single / as shown below. 






See more on Python escape characters here.

While this wont solve a missing Shapefile, it will overcome the SyntaxError you have described above.

0 Kudos