Arcpy 3.x methods

535
6
03-18-2019 07:49 AM
JoeBorgione
MVP Esteemed Contributor

We are in the process of migrating our Python 2.x scripts that run as scheduled tasks to Python 3.x.  One of theses uses the 'MetadataImporter_conversion' method.  In testing, this failed, indicating the Arcpy 3.x does not support the method.  I ran the method from a python window in ArcGIS Pro 2.3.1, and sure enough, it's not there. ( The auto-complete provides arcpy.ImportMetadata_topographic, but I haven't looked at that....)

Is there a list somewhere of Arcpy methods that were once supported in 2.x and are no longer supported in 3.x?  Does such a list provide replacements?

That should just about do it....
6 Replies
DanPatterson_Retired
MVP Esteemed Contributor
0 Kudos
JoeBorgione
MVP Esteemed Contributor

What version of the software are you talking about Joe?

2.3 and beyond.

I'l take a look at what you suggest.  Thanks!

That should just about do it....
0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

I could have swore it said arcpy 2.x and arcpy 3.x in the original post ... Just like the question title.... I thought I missed a whole generation of dot versions and a major change to boot

0 Kudos
JoeBorgione
MVP Esteemed Contributor

Version of ArcGIS Pro software: 2.3 and beyond.  Version of Arcpy: 3.x and beyond....

That should just about do it....
0 Kudos
Luke_Pinner
MVP Regular Contributor

Joe Borgione wrote:

Version of ArcGIS Pro software: 2.3 and beyond.  Version of Arcpy: 3.x and beyond....

Nope.  arcpy version == corresponding ArcGIS desktop/Pro version (the most recent version listed in Anaconda cloud Esri packages is 2.3)

I think you're thinking of the Python version, 2.x in ArcGIS Desktop 9-10x and 3.x in ArcGIS Pro.  

curtvprice
MVP Esteemed Contributor

I agree with Luke Pinner -- definitely identify arcpy with its 'host' software and version, that is arcpy (ArcMap 10.5.1) or arcpy (ArcMap 10.5.1 x64) or arcpy (Pro 2.3).   The ArcMap Python is always 2.x and and the Pro Python is always 3.x.

There are a limited group of tools that are not available in ArcGIS Pro. I don't know of a global list. (Update: There is one in the help!) Most tools are still there, the ones that are missing are related to tools that are simply not there anymore. Some tools have options that have been removed (Calculate Field only supports VBScript in x32 versions of arcpy.)

These missing tools include the ArcMap Coverage tools (since coverages are no longer supported in Pro), the metadata tools (from the ArcMap Conversion toolbox), some other random tools. There may be some geometric network tools that missing because the GM is replaced by the new Utility Network in Pro. Some other conversion tools (Create Personal Geodatabase, Import from Interchange file) are gone because the datatypes are not supported by Pro.

The Metadata GP tools from the Conversion toolbox are not supported in Pro because the XML framework they use is 32-bit only and ArcGIS Pro's Python is 64 bit. (They aren't available in ArcMap x64 bit background processing, either.)  There are no plans as far as I know to re-implement these tools in Pro. Last I heard they plan to satisfy the use cases for custom metadata manipulation using the SDK, but I have read elsewhere that they are in the "roadmap". It could be a while so I am glad ArcMap is here until at least 2025. I suggest leaving your metadata update script as-is in ArcMap's arcpy.

Unless you need some really new fancy Python 3 functionality, I recommend coding Python scripts so they will run in ArcMap (py 2.7) and Pro (py 3.5.x) for maximum code re-use. This is possible more often than you think!