AnsweredAssumed Answered

Halt/wait processing until Python script is complete.

Question asked by dalejs on Nov 26, 2014
Latest reply on Nov 29, 2014 by curtvprice

Thanks for looking at my issue.  I am calling a Python script with arguments from my VB.Net application.  What I want to do is have the application wait on the Python script to complete before it continues processing.


I am currently starting the Python script like this:


Dim A1 As String = "ExcelFile.xlsx"

Dim A2 As String = "DbfFile.dbf"


Shell("C:\Python27\arcGIS10.2\python.exe C:\PythonScripts\ " + A1 + " " + A2)


It works fine.


I am trying the following code, from what I have found the structure of the exe and arguments are correct(maybe-maybe not?).  What occurs is the executable does work as the black window opens then immediately closes.


Dim procStartInfo As System.Diagnostics.ProcessStartInfo = New System.Diagnostics.ProcessStartInfo("C:\Python27\arcGIS10.2\python.exe", "C:\PythonScripts\ " + A1 + " " + A2)


procStartInfo.RedirectStandardOutput = True

procStartInfo.UseShellExecute = True

procStartInfo.CreateNoWindow = False


Dim proc As New System.Diagnostics.Process()

proc.StartInfo = ProcStartInfo




Any ideas, do I have the code structure right?


Thanks for your time, Dale