-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
The above plus "ImportError: Could not locate the ArcGIS directory on this machine" if disabling the pro parameter are found on a fresh conda python=3.6 with newly installed ArcGIS Pro 2.x (tried 2.1, 2.5, 2.5.1):
import archook #The module which locates arcgis
archook.get_arcpy(pro = True)
import arcpy
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-7-31d7c887ec7a> in <module>
5 import Archook #The module which locates arcgis
----> 6 archook.get_arcpy(pro = True) # removal of pro keyword leads to second error.
7 import arcpy
TypeError: get_arcpy() got an unexpected keyword argument 'pro'
The issue is fixed by downloading a fresh archook copy from the github repo, and uncommenting/hardcoding the path:
def get_pro_paths():
"""Return 2 lists, for adding to Windows PATH and python sys.path"""
P = locate_arcgis(pro=True)
C = locate_pro_conda()
P = r"C:\Program Files\ArcGIS\Pro"
C = r"C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3"
import sys
import os
sys.path.insert(1,os.environ["HOMEDRIVE"]+os.environ["HOMEPATH"]+'/Documents/GitHub/arcgis-scripts')
import Archook #The module which locates arcgis
Archook.get_arcpy(pro = True) # success! :)
import arcpy
May I suggest implementing a forced path argument as well that specifies "P"? :)
P.s., good job on this - I spent hours running into the constant issue of ArcGIS pro not wanting to copy the default environment; and this finally did the trick.
alanscandrett
Metadata
Metadata
Assignees
Labels
No labels