Hi, I just have a basic question with the arcpy.mp.ArcGISProject() function while trying to follow along a simple tutorial that is a bit old. Here's the relevant code section below
# Import modules
import arcpy
# Create the map document object
aprx = arcpy.mp.ArcGISProject(r"C:\Users\User\Documents\ArcGIS\Projects\MyProject2.aprx")
And this is the OS Error in question:
Traceback (most recent call last):
File "C:\Users\User\Desktop\Exercise ArcGis Python\Ex_Files_ArcGIS_Python_Scripting\Exercise Files\WorkWithListsFinal.py", line 15, in <module>
aprx = arcpy.mp.ArcGISProject(r"C:\Users\User\Documents\ArcGIS\Projects\MyProject2.aprx")
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: C:\Users\User\Documents\ArcGIS\Projects\MyProject2.aprx
Not really sure what's happening here to not allow me reference the .aprx file which is what I thought the ArcGISProject() command did.
From Windows Explorer, could you ensure that the filepath of the aprx file is correct?
Just my assumption, maybe you missed the folder containing the aprx file (e.g. "C:\Users\User\Documents\ArcGIS\Projects\MyProject2\MyProject2.aprx")
or any other pathname
unless you altered the path
C:\Users\User\Documents\ArcGIS\Projects\MyProject2.aprx
probably should be
C:\Users\.. your user name ...\Documents\ArcGIS\Projects\MyProject2.aprx
where "your user name" is your identifier