Hello,
I try to run a external program from within arcmap.
Wherefore I made a model with the model builder. So I can select a point in my shape, run my model and the external program should run with a variable from this point. To start the program I use a simple python script.
To explain my problem, I have included the following line of code with which I started. If I uses this, the script does nothing, no error and no execution of anything:
os.system(r'C:\Program Files (x86)\AquaInfo\AI-Viewer.exe SystemMDW=C:\Program Files (x86)\AquaInfo\Aqua.mdw|UserMDB=C:\Program Files (x86)\AquaInfo\System\AI_mbn.mdb|DataBaseName=C:\Users\ps\Desktop\atest\Test.mdb|UserId=99999998|ObjIdsList=7297|SelObjId=7297|ObjType= 0|')
If I put this into windows cmd the program starts:
"C:\Program Files (x86)\AquaInfo\AI-Viewer.exe" "SystemMDW=C:\Program Files (x86)\AquaInfo\Aqua.mdw|UserMDB=C:\Program Files (x86)\AquaInfo\System\AI_mbn.mdb|DataBaseName=C:\Users\ps\Desktop\atest\Test.mdb|UserId=99999998|ObjIdsList=7297|SelObjId=7297|ObjType= 0|"
If I am using this python code in my module, the program starts with an error because obviously some variables are not set:
os.system(r'"C:\Program Files (x86)\AquaInfo\AI-Viewer.exe"')
Same if I try this:
os.system(r'"C:\Program Files (x86)\AquaInfo\AI-Viewer.exe"' + " SystemMDW=C:\Program Files (x86)\AquaInfo\Aqua.mdw")
As soon as I enter the Pipe Character "|" the script doesn't work any more. I tried to replace "|" with chr(124) but still the same error.
os.system(r'"C:\Program Files (x86)\AquaInfo\AI-Viewer.exe"' + " SystemMDW=C:\Program Files (x86)\AquaInfo\Aqua.mdw|")
I am not very firm with python, I am more experienced in vbs. Is there a problem with the "|" Character in Python Strings then it is used for a path with os.system?
How can I solve this.
Any ideas?
Thanks for your help.