I'm trying to start a separate process to run the ExcelToTable tool since running that tool in the same process as the rest of the script breaks all breakpoints that come after that line (supposedly this bug has been known for years but apparently no one wants to fix it) and I still need to be able to use breakpoints so... how can I get this process to run? Since I just need to run this tool a single time and wait for it to finish, I'm using the Process method instead of the Pool method. When I run my script, I get an error about being unable to pickle a geoprocessing result object.
<SPAN class="keyword token">class</SPAN> <SPAN class="token class-name">DomainData</SPAN><SPAN class="punctuation token">(</SPAN>object<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="string token">'''This is the base class for all domain data'''</SPAN>
<SPAN class="keyword token">def</SPAN> <SPAN class="token function">__init__</SPAN><SPAN class="punctuation token">(</SPAN>self<SPAN class="punctuation token">,</SPAN> folderPath<SPAN class="punctuation token">,</SPAN> gdbPath<SPAN class="punctuation token">,</SPAN> dbCon<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="comment token">#properties</SPAN>
<SPAN class="keyword token">def</SPAN> <SPAN class="token function">createDomain</SPAN><SPAN class="punctuation token">(</SPAN>self<SPAN class="punctuation token">,</SPAN> wsRows<SPAN class="punctuation token">,</SPAN> tblName<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="comment token">#Make Excel file</SPAN>
<SPAN class="comment token">#Save the file</SPAN>
wb<SPAN class="punctuation token">.</SPAN>save<SPAN class="punctuation token">(</SPAN>self<SPAN class="punctuation token">.</SPAN>wkbkName<SPAN class="punctuation token">)</SPAN>
savedTable <SPAN class="operator token">=</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>self<SPAN class="punctuation token">.</SPAN>gdb<SPAN class="punctuation token">,</SPAN> tblName<SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#Convert the excel file to an ArcMap table.</SPAN>
p <SPAN class="operator token">=</SPAN> multiprocessing<SPAN class="punctuation token">.</SPAN>Process<SPAN class="punctuation token">(</SPAN>target<SPAN class="operator token">=</SPAN>DomainData<SPAN class="punctuation token">.</SPAN>excl2Tbl<SPAN class="punctuation token">,</SPAN> args<SPAN class="operator token">=</SPAN><SPAN class="punctuation token">(</SPAN>self<SPAN class="punctuation token">,</SPAN> savedTable<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
p<SPAN class="punctuation token">.</SPAN>start<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
p<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>AddMessage<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"process ended"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">def</SPAN> <SPAN class="token function">excl2Tbl</SPAN><SPAN class="punctuation token">(</SPAN>self<SPAN class="punctuation token">,</SPAN> tbl<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>ExcelToTable_conversion<SPAN class="punctuation token">(</SPAN>self<SPAN class="punctuation token">.</SPAN>wkbkName<SPAN class="punctuation token">,</SPAN> tbl<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">if</SPAN> __name__ <SPAN class="operator token">==</SPAN> <SPAN class="string token">"__main__"</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="comment token">#do stuff</SPAN>
sprFA_dom<SPAN class="punctuation token">.</SPAN>createPointDomain<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#continue with the script</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>This is the error that comes back:
pickle.PicklingError: Can't pickle 'geoprocessing server result object' object: <geoprocessing server result object object at 0x1E415BA8>
I get that geoprocessing objects of any sort aren't pickleable, but I don't need to do anything with the object created; I don't need to return it. How do I get the process to just ignore it?