Arcpy in ArcGIS Pro 2.7.3 is giving errors when trying to create a spatial reference. It is happening with single digit WGS 1984 UTM Zones. Code to replicate below:
sr = arcpy.SpatialReference("WGS 1984 UTM Zone 10N")
print(sr.name)
WGS_1984_UTM_Zone_10N
sr = arcpy.SpatialReference("WGS 1984 UTM Zone 6S")
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\arcobjects\mixins.py", line 942, in __init__
self._arc_object.createFromFile(item, vcs)
RuntimeError: ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (http://esriurl.com/support) to Report a Bug, and refer to the error help for potential solutions or workarounds.
Found while investigating this post:
Create model that calculates spatial reference from a layer
Solved! Go to Solution.
You might try two spaces between Zone and 6S. I ran into a similar problem with Desktop, and the extra space was the fix. I think the extra space is used for aligning single and double digits.
>>> sr = arcpy.SpatialReference("WGS 1984 UTM Zone 10N")
>>> print sr.name
WGS_1984_UTM_Zone_10N
>>> sr = arcpy.SpatialReference("WGS 1984 UTM Zone 6S") # single space
Runtime error
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\program files (x86)\arcgis\desktop10.5\arcpy\arcpy\arcobjects\mixins.py", line 992, in __init__
self._arc_object.createFromFile(item, vcs)
RuntimeError: ERROR 999999: Error executing function.
>>> sr = arcpy.SpatialReference("WGS 1984 UTM Zone 6S") # double space
>>> print sr.name
WGS_1984_UTM_Zone_6S
You might try two spaces between Zone and 6S. I ran into a similar problem with Desktop, and the extra space was the fix. I think the extra space is used for aligning single and double digits.
>>> sr = arcpy.SpatialReference("WGS 1984 UTM Zone 10N")
>>> print sr.name
WGS_1984_UTM_Zone_10N
>>> sr = arcpy.SpatialReference("WGS 1984 UTM Zone 6S") # single space
Runtime error
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\program files (x86)\arcgis\desktop10.5\arcpy\arcpy\arcobjects\mixins.py", line 992, in __init__
self._arc_object.createFromFile(item, vcs)
RuntimeError: ERROR 999999: Error executing function.
>>> sr = arcpy.SpatialReference("WGS 1984 UTM Zone 6S") # double space
>>> print sr.name
WGS_1984_UTM_Zone_6S
Yes. I found the same.
The cause lies with the list of names of coordinate systems for ArcGIS Pro.
Same with ArcMap as well.