Frequently asked question

Is it possible to use the CURRENT keyword in a stand-alone Python script?

Last Published: April 6, 2022

Answer

No, it is not possible to use the CURRENT keyword in a stand-alone Python script. The sample below shows how to use the CURRENT keyword in a script:

import arcpy
aprx = arcpy.mp.ArcGISProject("CURRENT")

When attempting to run the script in a standalone environment, the following error is returned:

Error:
OSError: CURRENT 

This is expected behavior, as the CURRENT keyword only works within ArcGIS Pro and ArcMap.The CURRENT keyword references the arcpy.mp module to identify an open map in ArcGIS Pro. In a standalone environment, there is no map open which disables the ability to use the CURRENT keyword available in the ArcPy module.

Article ID:000027431

Software:
  • ArcMap 10 6
  • ArcGIS Pro 2 8 x
  • ArcGIS Pro 2 7 x
  • ArcMap 10 7
  • ArcGIS Pro 2 x
  • ArcMap 10 8

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Related Information

Discover more on this topic