- OSError

12-11-2018 08:52 AM
New Contributor III

I'm having issues using Python in ArcGIS Pro. I'm using Pro 2.2.4 and Spyder (Python 3.6).  I can't get '' to read my Pro project. I'm running a script to overwrite vector tile packages written by Kelly Gerrow. I added some code to create a vector tile package that worked just fine until this week. Now whenever I try to point to a Pro project it fails with the error below:

I am able to interact with my Pro Project in the python window using 'CURRENT' but not with the function. 

Here is the error I get when trying to create a vector package using the Python window and the 'CURRENT' project:

Has anyone seen this before? I'm stumped. Dan Patterson Joe Borgione

Tags (2)
0 Kudos
3 Replies
MVP Esteemed Contributor

To further elaborate: when I use the method as shown in James' PythonError.png path to a aprx file on my computer, it works when I run it in a python window. But I get the same error when I run it in a spyder window....

import arcpy

p ='C:\Users\JBorgione\Documents\ArcGIS\Packages\LocalGovernment3DBasemaps_F9C2F2D1-1C82-4CB8-B571-1E74A1281032\p20\copy.arpx')

##### error below #####

Traceback (most recent call last):

  File "<ipython-input-25-10564330aca1>", line 1, in <module>
    p ='C:\Users\JBorgione\Documents\ArcGIS\Packages\LocalGovernment3DBasemaps_F9C2F2D1-1C82-4CB8-B571-1E74A1281032\p20\copy.arpx')

  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\", line 299, in __init__
    self._arc_object = arcgisscripting._mapping.ArcGISProject(*gp_fixargs((aprx_path,), True))

OSError: C:\Users\JBorgione\Documents\ArcGIS\Packages\LocalGovernment3DBasemaps_F9C2F2D1-1C82-4CB8-B571-1E74A1281032\p20\copy.arpx

Not sure what the OSError is all about.  I can set a variable that paths to the same file just fine in spyder:

file = r'C:\Users\JBorgione\Documents\ArcGIS\Packages\LocalGovernment3DBasemaps_F9C2F2D1-1C82-4CB8-B571-1E74A1281032\p20\copy.arpx'


As James mentioned, this came to us in a script from ESRI, and we are trying to get to work....

Dan Patterson

That should just about do it....
MVP Legendary Contributor

I never use Users folder (we have an expression for that folder).

And as for the rest of the file path... can we squeeze any more punctuation in there!

In a 'normal', simple path.  No problem

Try putting the file in a different location.

pth = r"C:\Git_Dan\arraytools\array_tools_testing\array_tools.aprx"

import arcpy

p =


Out[275]: ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__',
.... snip.... 'activeMap', 'dateSaved', 'defaultGeodatabase', 'defaultToolbox',
 'documentVersion', 'filePath', 'homeFolder', 'importDocument', 'listBrokenDataSources', 
'listColorRamps', 'listLayouts', 'listMaps', 'listReports', 'save', 'saveACopy',

Spyder latest version 3.3.2

python 3.6.6 64 bit

ArcGIS PRO Beta 2.3 (although that doesn't make a difference)

MVP Esteemed Contributor

Not much of a fan of users directory either, but that install comes free of charge with the ESRI local gov't solutions package. (The dashes '-' are particularly troublesome for me...)  Just for fun:

p ='C:\Dans_Folder\copy.aprx')

for m in p.listMaps():
Schematic Local Government Scene
Basic Local Government Scene
Realistic Local Government Scene

 This works for me in spyder as well as the python window in Pro.  Need to look at James' install, and maybe reinstall. 

Something isn't right...

That should just about do it....