That sounds correct but I have not heard of this .rpl program and couldn't say how it should be called on the command line. But to me it still sounds like the .rpl is a file that is run by some other executable you have not specified as of yet.Using subprocess.call() should pause the script until the called process terminates.
subprocess.call(['C:\Downloads\Multiple File Search Replace\REPLACE.exe','C:\Downloads\Multiple File Search Replace\Noname.rpl'])
Sorry, I'll try to reword what it is I am doing. The .rpl is the program itself ( I probably should have mentioned this is the program I am using instead of refering to it as a file). It is an interface that allows me to find and replace tags in with values .xml files which I want to import into feature classes later on. The .rpl is the executable.I'm thinking that if I interpret what you have said, Logan, is that my first argument should be the location of the program I want to call (or open) and the second argument should be the file or files that I want to run it against (ie the .xml)? Basically my current process is this:1. open the .rpl program2. enter the information that I need to edit (ie user name, dates, project site name, email address, etc...)3. Run that against 12 template .xml files which finds tags and string variables and replaces them with the information I entered into the .rpl program4. Import .xml into the metadata to the matching feature class.5. FinI hope this makes it a little more clearer as to my process and end result.
Actually, the os.startfile() runs pretty cool. It might be more of what I am looking to do. I'm thinking it might take a little more than my abilities to make this program run in the background the way I would like. My thought process now is maybe just to prompt the script to run like this:1. Run my python script and let it process my maps, layers, etc2. When the script gets to the block to os.startfile(my.rpl program), the .rpl opens and in the same breath, pauses the python program3. allow user to enter the information in the .rpl program and run it.4. when they close the .rpl program, the rest of the python script continues onI see some syntaxes like os.wait() that may pause the python script, maybe something like os.when_program_closes_continue_python....just reaching at straws now 🙂
args should be a string, or a sequence of program arguments. The program to execute is normally the first item in the args sequence or the string if a string is given, but can be explicitly set by using the executable argument. When executable is given, the first item in the args sequence is still treated by most programs as the command name, which can then be different from the actual executable name
subprocess.call(['Z:\ESRI\IOR_Run_Metadata_2009\RunMetadata.rpl', r'Z:\ESRI\IOR_Run_Metadata_2009\RunMetadata.rpl'])
PYTHON ERRORS:Traceback info: File "Z:/ESRI/Python/Test Scripts/SubProcess.py", line 9, in <module> subprocess.call([r'Z:\ESRI\IOR_Run_Metadata_2009\RunMetadata.rpl', r'Z:\ESRI\IOR_Run_Metadata_2009\RunMetadata.exe'])Error Info:[Error 193] %1 is not a valid Win32 applicationArcPy ERRORS:
import subprocess subprocess.call(['RunMetadata.exe', r'Z:\ESRI\IOR_Run_Metadata_2009\RunMetadata.rpl'])
PYTHON ERRORS:Traceback info: File "Z:/ESRI/Python/Test Scripts/SubProcess.py", line 9, in <module> subprocess.call(['RunMetadata.exe', r'Z:\ESRI\IOR_Run_Metadata_2009\RunMetadata.rpl'])Error Info:[Error 2] The system cannot find the file specifiedArcPy ERRORS:
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.