<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Halt/wait VB.net processing until Python script is complete. in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/halt-wait-vb-net-processing-until-python-script-is/m-p/320459#M24893</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for looking at my issue.&amp;nbsp; I am calling a Python script with arguments from my VB.Net application.&amp;nbsp; What I want to do is have the VB.net application wait on the Python script to complete before it continues processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am currently starting the Python script like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt;Dim A1 &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;As&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;String&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-size: 10pt; font-family: Consolas;"&gt;"ExcelFile.xlsx"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;Dim&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; A2 &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;As&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;String&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-size: 10pt; font-family: Consolas;"&gt;"DbfFile.dbf"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shell(&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: 10pt;"&gt;"C:\Python27\arcGIS10.2\python.exe C:\PythonScripts\ExceltoDBF.py &lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: 10pt;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: 10pt;"&gt; + A1 + &lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: 10pt;"&gt;" "&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: 10pt;"&gt; + A2)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;It works fine.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;I am trying the following code, from what I have found the structure of the exe and arguments are correct(maybe-maybe not?).&amp;nbsp; What occurs is the executable does work as the black window opens then immediately closes. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;Dim&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; procStartInfo &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;As&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; System.Diagnostics.&lt;/SPAN&gt;&lt;SPAN style="color: #2b91af; font-size: 10pt; font-family: Consolas;"&gt;ProcessStartInfo&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;New&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; System.Diagnostics.&lt;/SPAN&gt;&lt;SPAN style="color: #2b91af; font-size: 10pt; font-family: Consolas;"&gt;ProcessStartInfo&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-size: 10pt; font-family: Consolas;"&gt;"C:\Python27\arcGIS10.2\python.exe"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt;, "&lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-size: 10pt; font-family: Consolas;"&gt;C:\PythonScripts\ExceltoDBF.py &lt;SPAN style="color: #a31515; font-family: Consolas; font-size: 10pt;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: 10pt;"&gt; + A1 + &lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: 10pt;"&gt;" "&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: 10pt;"&gt; + A2)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;procStartInfo.RedirectStandardOutput = True&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;procStartInfo.UseShellExecute = True&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;procStartInfo.CreateNoWindow = False&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;Dim proc As New System.Diagnostics.Process()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;proc.StartInfo = ProcStartInfo&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;proc.Start() &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;proc.WaitForExit()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d;"&gt;Any ideas, do I have the code structure right?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d;"&gt;Thanks for your time, Dale&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 26 Nov 2014 17:57:02 GMT</pubDate>
    <dc:creator>DaleShearer</dc:creator>
    <dc:date>2014-11-26T17:57:02Z</dc:date>
    <item>
      <title>Halt/wait VB.net processing until Python script is complete.</title>
      <link>https://community.esri.com/t5/python-questions/halt-wait-vb-net-processing-until-python-script-is/m-p/320459#M24893</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for looking at my issue.&amp;nbsp; I am calling a Python script with arguments from my VB.Net application.&amp;nbsp; What I want to do is have the VB.net application wait on the Python script to complete before it continues processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am currently starting the Python script like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt;Dim A1 &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;As&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;String&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-size: 10pt; font-family: Consolas;"&gt;"ExcelFile.xlsx"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;Dim&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; A2 &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;As&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;String&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-size: 10pt; font-family: Consolas;"&gt;"DbfFile.dbf"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shell(&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: 10pt;"&gt;"C:\Python27\arcGIS10.2\python.exe C:\PythonScripts\ExceltoDBF.py &lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: 10pt;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: 10pt;"&gt; + A1 + &lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: 10pt;"&gt;" "&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: 10pt;"&gt; + A2)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;It works fine.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;I am trying the following code, from what I have found the structure of the exe and arguments are correct(maybe-maybe not?).&amp;nbsp; What occurs is the executable does work as the black window opens then immediately closes. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;Dim&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; procStartInfo &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;As&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; System.Diagnostics.&lt;/SPAN&gt;&lt;SPAN style="color: #2b91af; font-size: 10pt; font-family: Consolas;"&gt;ProcessStartInfo&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;New&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; System.Diagnostics.&lt;/SPAN&gt;&lt;SPAN style="color: #2b91af; font-size: 10pt; font-family: Consolas;"&gt;ProcessStartInfo&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-size: 10pt; font-family: Consolas;"&gt;"C:\Python27\arcGIS10.2\python.exe"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt;, "&lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-size: 10pt; font-family: Consolas;"&gt;C:\PythonScripts\ExceltoDBF.py &lt;SPAN style="color: #a31515; font-family: Consolas; font-size: 10pt;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: 10pt;"&gt; + A1 + &lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: 10pt;"&gt;" "&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: 10pt;"&gt; + A2)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;procStartInfo.RedirectStandardOutput = True&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;procStartInfo.UseShellExecute = True&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;procStartInfo.CreateNoWindow = False&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;Dim proc As New System.Diagnostics.Process()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;proc.StartInfo = ProcStartInfo&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;proc.Start() &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;proc.WaitForExit()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d;"&gt;Any ideas, do I have the code structure right?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d;"&gt;Thanks for your time, Dale&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Nov 2014 17:57:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/halt-wait-vb-net-processing-until-python-script-is/m-p/320459#M24893</guid>
      <dc:creator>DaleShearer</dc:creator>
      <dc:date>2014-11-26T17:57:02Z</dc:date>
    </item>
    <item>
      <title>Re: Halt/wait VB.net processing until Python script is complete.</title>
      <link>https://community.esri.com/t5/python-questions/halt-wait-vb-net-processing-until-python-script-is/m-p/320460#M24894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well that was not too hard to fix, in a couple of lines of code that I was alternating between, in one line I had a space between "Python" and "Scripts": &lt;SPAN style="color: #a31515; font-family: Consolas; font-size: 10pt;"&gt;C:\Python Scripts\ExceltoDBF.py&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Once I removed the space it worked fine:&amp;nbsp; &lt;SPAN style="color: #a31515; font-family: Consolas; font-size: 10pt;"&gt;C:\PythonScripts\ExceltoDBF.py &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Nov 2014 21:12:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/halt-wait-vb-net-processing-until-python-script-is/m-p/320460#M24894</guid>
      <dc:creator>DaleShearer</dc:creator>
      <dc:date>2014-11-26T21:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: Halt/wait VB.net processing until Python script is complete.</title>
      <link>https://community.esri.com/t5/python-questions/halt-wait-vb-net-processing-until-python-script-is/m-p/320461#M24895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why aren't you using the Wait property of the Shell function? Seems like that would be less trouble...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/xe736fyk(v=vs.90).aspx" title="http://msdn.microsoft.com/en-us/library/xe736fyk(v=vs.90).aspx"&gt;Shell Function&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 Nov 2014 05:24:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/halt-wait-vb-net-processing-until-python-script-is/m-p/320461#M24895</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2014-11-30T05:24:25Z</dc:date>
    </item>
  </channel>
</rss>

