My python scripts that call ArcGIS.gis and pandas module work fine in jupyter notebook. But failed when running as a standalone py file. I used the same commands (see below) to setup the environment before launching jupyter notebook or the py file. Anything I missed for running the py file standalone?
set PATH=C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3;C:\Program Files\ArcGIS\Pro\bin\Python\Scripts;C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Scripts;%PATH%
set PYTHONPATH=C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages;%PYTHONPATH%
Hi Alan,
From what I see above you are looking to access the api from the python environment installed with pro.
Take a look at the following help topic, it will outline the different ways you can access and run a stand alone script from that environment:
Run stand-alone scripts—ArcPy Get Started | ArcGIS Desktop
Let me know if you have any questions.
Thanks,
Jeff
Allen, is this question related to your other one from today: https://community.esri.com/thread/218173-error-in-importing-arcgisgis-module
Yes it was related, but I am asking for a more general question.
Ok, don't know why, but if I replace my python script call in the bat file
BHP_AGOL_API_module_tests.py
with
"C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe" BHP_AGOL_API_module_tests.py
Then everything works fine, both arcgis.gis and pandas.
That is the version of python that is associated with the anaconda distribution, hence it is the one that you should be using for Pro and ArcGIS work
But I thought my path setting should have taken care of it.
Allen, it is just easier to create desktop shortcuts to your python IDE (example uses spyder), Jupyter Notebook and IPython and the proenv.bat file.... see this for examples
/blogs/dan_patterson/2017/07/01/arcgis-pro-2-creating-desktop-shortcuts
and one specifically for Jupyter
/blogs/dan_patterson/2017/07/09/arcgis-pro-2-jupyter-notebook-setup-basics