Value Error when adding layer to map ArcPro

1093
2
08-14-2019 06:50 AM
Zeke
by
Regular Contributor III

In a script, I'm creating a feature layer and trying to add it to a map in ArcGIS Pro 2.3.0. When I try to add it though, I get a ValueError. Any ideas why and how to fix it?

FYI, I'm running the script in Spyder, Python 3.6.6, which I installed (maybe correctly, maybe not) in the default ArcGIS Pro environment. It seems to recognize the arcpy module, although there's no intellisense.

arcpy.MakeFeatureLayer_management('GPP', 'Area501')

m.addLayer('Area501')  # ValueError: Area501

0 Kudos
2 Replies
Ebenezer_AttuaJnr
New Contributor

I faced this problem recently. My solution was to load the file using a path rather:

m.addDataFromPath(myFilePath)

with myFilePath being the feature class URL. Reach out to me if you need further assistance.

All is well.

0 Kudos
JohannesBierer
Occasional Contributor III
0 Kudos