Hello,
is it possible to run a bat file using the version of Python (ArcPy) supplied with ArcGIS Pro 2.9 or ArcMap 10.8?
Thank you
Yes I think you are right, I have been having a similar thought myself. Ultimately I will need to create a Python script, an ESRI Tool, a Geoprocessing Task and then add that to a WAB just to allow a nicer interface for the users.
I could probably just put the BAT file on a shared folder on the server and add permissions so they can run the FME workspace on the server.
Can you just have the user run the bat file from there desktops? Is the FME workspace and environment going to be on a server?
I would rather access python installed by ArcMap 10.8 if possible so that no additional software is required.
It won't be to run a Scheduled Task, the BAT I'm creating ultimately will trigger and FME Workspace to run but it has to be run on demand by the user as and when required.
Example of sub process use:
import argparse import os import subprocess parser = argparse.ArgumentParser(description='initialize electric trace weights') parser.add_argument('--env', help='target environment: dev, test , or prod', default='dev') args = parser.parse_args() env = args.env database = {'dev': 'dev', 'test': 'test', 'prod': 'prod'}[env] working_dir = os.path.dirname(os.path.realpath(__file__)) password = xyz trace_weight_exe = os.path.join(working_dir, 'ElectricTraceWeightInit.exe') command = '"{exe}" {db} {pw}'.format(exe=trace_weight_exe, db=database, pw=password) process = subprocess.Popen(command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) exit_code = process.wait()
Are you trying to access python modules that are not installed by default during the installation of ArcMap or Pro?
Is this for the eventual goal of running a Windows Scheduled Task on a regular interval?
Installing ArcGIS (ArcMap or Pro) includes a full install of Python (2.x for ArcMap, 3.x for Pro). There's no need to install Python if you've already installed ArcGIS.
Can regular Python from https://www.python.org be installed also when my server already has a "Python27" folder setup as Arcmap 10.8 is installed on this machine already.
Thanks
You can run any program at all that you have permission to run on the computer. Here is a quick example.
https://datatofish.com/batch-file-from-python/
You wouldn't use arcpy, you would use the subprocess module built into Python.
https://stackoverflow.com/a/5469427
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.