Hey all,
I assume this is a relatively simple question with a relatively simple answer. When opening this ArcPro project file, I am presented with a request to enter credentials:
Even though I select Windows Credential Manager, it does not save, but that's fine for this purpose.
When accessing this through Arcpy or attempting to at least, I get this:
I assume this is due to the authentication, we do not have access to the REST environment, so I cannot use the API for Python, so Arcpy must be employed.
How should I accomplish this?
Thanks in advance!
Cody
I would check to make sure the layer is correct.
test = map.listLayers("FiberCable")[0]
print(f"Selected layer: {test.name}") # Check the layer name
print(f"Data source: {test.dataSource}") # Verify the data source path
arcpy.MakeFeatureLayer_management(test.dataSource, 'testinglayer')
Hey @TonyAlmeida
Great suggestion! This actually showed me whether or not I was logged in on the layer, appears so:
The USER item is filled with the username, not sure if it actually is logged in, but it unfortunately did not work.
Cody
Try using the layer object returned by the MakeFeatureLayer result, line 8.
test = map.listLayers("FiberCable")[0]
# Verify the original layer details
print(f"Original layer: {test.name}")
print(f"Data source: {test.dataSource}")
# Returned layer object
result = arcpy.MakeFeatureLayer_management(test.dataSource, 'testinglayer')
# Get the layer object from the result
testing_layer = result.getOutput(0)
# Now work with `testing_layer`
print(f"Selected layer: {testing_layer.name}") # Layer name
print(f"Data source: {testing_layer.dataSource}") # Data source path
Hey @TonyAlmeida
Thank you for another suggestion, unfortunately this didn't work either. This time it's related to a bug regarding the MakeFeatureLayer using the Feature Service link. I was told by ESRI support that this was too advanced of an issue to work through so it was marked as a Known Limit which means it will not be worked on.
This is the error I received:
Bug link: https://my.esri.com/#/support/bugs/bugs?bugNumber=BUG-000144037
Cody
I didn't know that. Thanks for sharing!