Currently building a GDB with 100+ feature classes which will need metadata elements for certain fields to be used in an online tool popup. I am working on a Python script to update these elements, instead of using ArcCatalog for the management part. I am able to update about 20-25 elements just fine, but there's a couple where I am having issues with either in calling it in the script, or having the element actually update:

1) Publication Date: issue is that it's not being recognized; getting error: "KeyError: 'publication_date'"

publication_date = metadata.publication_date
metadata.publication_date = "20100101"

I am able to do this through the arcpy_metadata library. In it there is a script called Elements.py which I am customizing if I encounter an element I want that's not in there. Publication Data (#1 above) isn't in there, so my attempt at adding it looks like:

"publication_date": {
        "path": "dataIdInfo/idCitation/date/pubDate",
        "type": "dateTime"},

I've tried various formats for the time imputation, but I think the source of the problem is the "publication_date" class that I have in the library, specifically the source of the element and the actual tags that I need to call it out.

Code that's being passed in ArcMap:

import arcpy_metadata as md
metadata = md.MetadataEditor(path to fc)

title = metadata.title
metadata.title = "There are many variations of passages"

publication_date = metadata.publication_date
metadata.publication_date = "20100101"

  • At the moment you appear to be presenting a copy/paste of a few lines from your code rather than a code snippet that illustrates what you have tried and where you are stuck. What code creates your metadata object? – PolyGeo Jul 17 '18 at 12:26
  • To be clear, you're using: github.com/ucd-cws/arcpy_metadata ? – KHibma Jul 17 '18 at 15:30
  • @KHibma - correct. Downloaded locally and am making local changes to the elements.py script – Dave Jul 17 '18 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.