I'm trying to run a Python script (shapefile_upload.py) which uses ArcGIS libraries. I installed the ArcGIS libraries by following exactly these instructions.
The Python script uploads a shapefile to ArcGIS Online. It takes several arguments (ArcGIS Online URL, path to shapefile, username, and password).
I need to run the Python script in a .bat file. The .bat file looks like this:
call "c:\ProgramData\Anaconda3\envs\ArcGIS_Test\python.exe" shapefile_upload.py URL Path_to_shapefile -U Username -P Password
When I select "Open Terminal" in Anaconda Navigator for the ArcGIS_Test environment and execute this .bat script, the shapefile is successfully uploaded to ArcGIS Online.
However, when I open a regular cmd window (not via Anaconda Navigator), and run the .bat script, I get an error that it's unable to ArcGIS Online, and the shapefile is not uploaded.
I think the Python environment is not used properly by the .bat file when run from the basic windows cmd window, even though I'm calling the Python interpreter within the correct environment.
What do I need to change in my .bat script for the environment to be set properly?