0

I'm new to Python. I try to access my 'current' project but I keep getting an error:

Traceback (most recent call last):
  File "C:\Users\...\test.py", line 6, in <module>
    aprx = arcpy.mp.ArcGISProject('CURRENT')
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\_mp.py", line 344, in __init__
    self._arc_object = arcgisscripting._mapping.ArcGISProject(*gp_fixargs((aprx_path,), True))
OSError: CURRENT

I tried using upper and lower case single and double quote.

Here is the 1st part of my code.

#-*- coding: utf-8 -*- 

import arcpy

aprx = arcpy.mp.ArcGISProject('CURRENT')
0

1 Answer 1

5

Based on your trace back, it appears you're calling this from test.py, which I'd guess means you're calling a file OUTSIDE ArcGIS Pro (you're calling the script from command line or an IDE). The CURRENT keyword only works when you're inside ArcGIS Pro. It does not work outside the app, like when you're calling from command line or in an IDE. In those cases, you need a full path to the .APRX

The only time you can use CURRENT is if calling from the Python window, or a script tool inside ArcGIS Pro.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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