ArcGIS Pro uses Python 3 whereas the other ArcGIS for Desktop applications (ArcMap, ArcCatalog, ArcScene and ArcGlobe) use Python 2 and
the changes introduced with ArcGIS Pro were significant enough to merit a module name space change. The new name also offers more flexibility in terms of the capabilities
arcpy.mpcan offer. For example, in addition to map automation,
arcpy.mpcan also provide project level management.
Is there an Esri recommended way to refer to the ArcPy site-package that is imported into Python 3, that enables it to be distinguished during communication between ArcPy developers from the ArcPy site-package that is imported into Python 2?
It is clearly not identical (although it may be very similar) because when I run the script below on a machine that has both ArcGIS 10.3.1 and ArcGIS Pro 1.1.1 installed, from Python 2 vs Python 3, two different results occur.
import arcpy if arcpy.Exists("C:/Temp/test.gdb"): arcpy.Delete_management("C:/Temp/test.gdb") arcpy.CreateFileGDB_management("C:/Temp", "test", "CURRENT") arcpy.CreateFishnet_management("C:/Temp/test.gdb/TestFC", "0 0","0 1","1","1","2", "2", "","NO_LABELS","DEFAULT","POLYGON") arcpy.MakeFeatureLayer_management("C:/Temp/test.gdb/TestFC","TestFC_Layer") arcpy.MakeTableView_management("C:/Temp/test.gdb/TestFC","TestFC_View") arcpy.CopyRows_management("TestFC_View","C:/Temp/test.gdb/TestTable") arcpy.AddRelate_management("TestFC_Layer", "OID", "C:/Temp/test.gdb/TestTable", "OBJECTID", "test_relate")
If you put the above code into a Python script and run it using IDLE 2.7.8 the result is:
Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> ================================ RESTART ================================ >>> Traceback (most recent call last): File "C:\Temp\test.py", line 12, in <module> arcpy.AddRelate_management("TestFC_Layer", "OID", "C:/Temp/test.gdb/TestTable", "OBJECTID", "test_relate") AttributeError: 'module' object has no attribute 'AddRelate_management' >>>
I expected this because ArcPy, when used with ArcGIS 10.x for Desktop from Python 2, does not have an Add Relate tool.
If you put the above code into a Python script and run it using IDLE 3.4.1 the result is:
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:45:13) [MSC v.1600 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. >>> ================================ RESTART ================================ >>> >>>
i.e. it worked!
I expected this too because ArcPy, when used with ArcGIS Pro from Python 3, does have an Add Relate tool.
When ArcGIS users are communicating between themselves about ArcPy since the release of ArcGIS Pro, there seems not to be a recommended way to describe the distinction.
Often it may be possible to tell from context, but in at least one question here (Add/Remove Relate using ArcPy without ArcGIS Pro?), which led to this one, the precise context within which the term ArcPy is being used was not initially clear, and which it was would lead to very different answers.
When working with ArcGIS, I always prefer to use the terminology that Esri uses, in order to be respectful to its developers, and I do the same for any development team.
Perhaps when you use/test ArcPy and want to communicate what you did with another ArcPy developer, like I have tried to in this question, then you just need to be careful to say:
- whether ArcGIS Pro and/or ArcMap etc is installed; and/or
- whether you are testing/using the script against Python 3 and/or Python 2
Much ArcPy code will run successfully without knowing the above (the first seven lines in my test above did), but as illustrated in the test code and procedure, some will not.
I think that I am going to have to say either:
- for this test/tool/application I used ArcPy with Python 2 and the ArcGIS 10.x architecture; or
- for this test/tool/application I used ArcPy with Python 3 and ArcGIS Pro
If Esri were using terminology like "ArcPy" and "ArcPy Pro" (as an example) then we would have a concise way to make the distinction but, from comments and an answers here, that path has not been taken.