Issues Accessing Pro Metadata with Python

03-27-2023 09:06 AM
by Anonymous User
Not applicable

Hi I've been unable to access ArcGIS Pro metadata with Python and was wondering if anyone could help. I've been trying to use the documentation's ( last example screenshotted below but when I run item_md.title with my item's metadata object, it outputs None.


To test, this is what I outputted:

print(item_metadata) # prints <arcpy.metadata.Metadata object at [address]>
print(item_metadata.title) # prints None
print(type(item_metadata.title)) # prints <class 'NoneType'>
print(item_metadata.description) # prints None
print(type(item_metadata.description)) # prints <class 'NoneType'>

I found some similar forum posts from 2019 and 2020 without solutions but I was hoping that there'd be some updates by now. My arcgispro and arcpy python packages are both version 2.7.


Thank you!

Tags (3)
0 Kudos
1 Reply
Esri Regular Contributor

Can you show the earlier part of your code where you access the input feature class? Are you able to view the metadata successfully from within Pro? As a cross-check, you could export the metadata to another format and confirm the contents are present in that XML. It should be possible to use arcpy.metadata, but failing that the lxml package can be used to extract information from any XML file.

0 Kudos