<?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 Re: Multiprocessing in Stand-alone Script in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/multiprocessing-in-stand-alone-script/m-p/296617#M22917</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, lets move on to the other missing bit of info...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="" style="color: #000000; background: #f5f2f0; border: 0px; font-size: 14px; margin: 0.5em 0px; padding: 1em 1em 1em 3.8em;"&gt;&lt;CODE style="border: 0px; font-weight: inherit; font-size: 14px;"&gt;countSelection&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 25 Aug 2020 23:11:11 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2020-08-25T23:11:11Z</dc:date>
    <item>
      <title>Multiprocessing in Stand-alone Script</title>
      <link>https://community.esri.com/t5/python-questions/multiprocessing-in-stand-alone-script/m-p/296613#M22913</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I recently switched from ArcMap to ArcGIS Pro and am having trouble getting multiprocessing to work in an old script. It worked at one point in ArcMap, but recent testing shows it no longer works with a Python 2.7 interpreter either, so it needs to be overhauled in a way I can't figure out. Literally the only reason I need to run this in a separate process is because&amp;nbsp;calling a script tool (TableToExcel) in a standalone script while debugging means none of the breakpoints will be hit after I run that line in my IDE (&lt;A href="https://community.esri.com/thread/230524" target="_blank"&gt;Debugging with ArcPy breakpoints after Point to Line&lt;/A&gt;). Any insight on how to get this working a separate process would be appreciated...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; multiprocessing

&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;tbl2excl&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyr&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; path&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;TableToExcel_conversion&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyr&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; path&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'ALIAS'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;overwriteOutput &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; __name__ &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'__main__'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;#Get the data and do a couple things&lt;/SPAN&gt;
    fileName &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; now&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;strftime&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"%Y-%m-%d"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    p &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; multiprocessing&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Process&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;target&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;tbl2excl&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; args&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;countSelection&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"E:\GIS_Testing\xxx"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fileName &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"_Counts.xls"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    p&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;start&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    p&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It just gets hung up after running p.join() and never stops. I assume it's erroring out in the new process somewhere, but I can't bring those error messages up to the parent script despite my efforts. If I&amp;nbsp;don't try to run it in a separate process&amp;nbsp;it doesn't error, so it's something specific to the multiprocessing, not using the TableToExcel tool itself.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:13:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multiprocessing-in-stand-alone-script/m-p/296613#M22913</guid>
      <dc:creator>MKF62</dc:creator>
      <dc:date>2021-12-11T14:13:46Z</dc:date>
    </item>
    <item>
      <title>Re: Multiprocessing in Stand-alone Script</title>
      <link>https://community.esri.com/t5/python-questions/multiprocessing-in-stand-alone-script/m-p/296614#M22914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If that is the actual path, then that is the problem... use raw encoding&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;p &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"E:\GIS_Testing\xxx"&lt;/SPAN&gt;
  File &lt;SPAN class="string token"&gt;"&amp;lt;ipython-input-1-018658955c3a&amp;gt;"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; line &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;
    p &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"E:\GIS_Testing\xxx"&lt;/SPAN&gt;
       &lt;SPAN class="operator token"&gt;^&lt;/SPAN&gt;
SyntaxError&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;unicode error&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'unicodeescape'&lt;/SPAN&gt; codec can't decode bytes &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; position &lt;SPAN class="number token"&gt;14&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;15&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; truncated \xXX escape&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:13:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multiprocessing-in-stand-alone-script/m-p/296614#M22914</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-12-11T14:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: Multiprocessing in Stand-alone Script</title>
      <link>https://community.esri.com/t5/python-questions/multiprocessing-in-stand-alone-script/m-p/296615#M22915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry - it's not the actual path, I just didn't want to put the whole thing in.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Aug 2020 19:54:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multiprocessing-in-stand-alone-script/m-p/296615#M22915</guid>
      <dc:creator>MKF62</dc:creator>
      <dc:date>2020-08-25T19:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: Multiprocessing in Stand-alone Script</title>
      <link>https://community.esri.com/t5/python-questions/multiprocessing-in-stand-alone-script/m-p/296616#M22916</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But Dan still has a point. I always use raw encoding for paths.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;r&lt;SPAN class="string token"&gt;'c:\xxxx\xxxx\xxxx'&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Aug 2020 20:01:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multiprocessing-in-stand-alone-script/m-p/296616#M22916</guid>
      <dc:creator>forestknutsen1</dc:creator>
      <dc:date>2020-08-25T20:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: Multiprocessing in Stand-alone Script</title>
      <link>https://community.esri.com/t5/python-questions/multiprocessing-in-stand-alone-script/m-p/296617#M22917</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, lets move on to the other missing bit of info...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="" style="color: #000000; background: #f5f2f0; border: 0px; font-size: 14px; margin: 0.5em 0px; padding: 1em 1em 1em 3.8em;"&gt;&lt;CODE style="border: 0px; font-weight: inherit; font-size: 14px;"&gt;countSelection&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Aug 2020 23:11:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multiprocessing-in-stand-alone-script/m-p/296617#M22917</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-08-25T23:11:11Z</dc:date>
    </item>
    <item>
      <title>Re: Multiprocessing in Stand-alone Script</title>
      <link>https://community.esri.com/t5/python-questions/multiprocessing-in-stand-alone-script/m-p/296618#M22918</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For debugging, it might be best to start with &lt;A class="" href="https://docs.python.org/3/library/subprocess.html" title="https://docs.python.org/3/library/subprocess.html"&gt;subprocess — Python 3.8.5?&amp;nbsp;&amp;nbsp; &lt;/A&gt;and graduate to multiprocessing once you know it works as a separate process.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Aug 2020 23:18:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multiprocessing-in-stand-alone-script/m-p/296618#M22918</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-08-25T23:18:53Z</dc:date>
    </item>
  </channel>
</rss>

