AnsweredAssumed Answered

Error code 246 when attempting to import ArcGIS API for Python through CMD prompt

Question asked by jhuillery_mbhydro on Feb 25, 2020
Latest reply on Feb 26, 2020 by jhuillery_mbhydro

My scripts fail about half the time with error code 246 on importing the ArcGIS API for Python when executing the script from a batch file.


My batch file:

@echo off
"C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe" "C:\Users\jhuillery\Desktop\"
if errorlevel 1 (echo Failure Reason Given is %errorlevel%)

My script (

print('importing sys...')
import sys
print('importing arcgis...')
    from arcgis.gis import GIS
except ImportError:

CMD output:

importing sys...
C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe
importing arcgis...
Failure Reason Given is 246

I'm using:

  • ArcGIS Pro 2.5.0
  • ArcGIS API for Python 1.7.0
  • Windows 10 Enterprise