4

I am using ArcGIS 10.5 and i am trying to get metadata information of a featureclass by calling following statement from arcpy within the ArcGIS Environment.

import arcpy
from arcpy import metadata as md

But i am getting following error

Runtime error 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: cannot import name metadata

Do i need to enable some extension or import this library some other way to make this work ?

4

I suspect that you may be following a code sample for the metadata module of ArcPy which is only available to work with the ArcGIS Pro (and not ArcMap) application of ArcGIS Desktop, and only since ArcGIS Pro 2.5 was released:

The Metadata class allows you to access an item's metadata, and export metadata to a standard metadata format. If you have appropriate privileges, the class allows you to modify an item's metadata, or import a standard-format metadata XML file's content to an item.

Consequently, to follow that or a similar code sample you need to be working with ArcGIS Pro at its version 2.5 or later.

To do something similar with ArcMap using a third party Python module see this answer to Programmatically edit/update metadata in ArcGIS?.

2
  • 1
    Thats exactly what happened. I saw the sample of metadata module. I will use ArcGIS Pro now. – user4906240 Mar 2 '20 at 5:01
  • This helped my question as well. I'm not on Pro 2.5 yet. Evidently the metadata module isn't in 2.4. – kpierce8 Apr 22 '20 at 18:55

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.