Saturday, 5 December 2015

arcgis 10.2 - ArcPy Multiprocessing 000714 - Working in Debug Mode


In an attempt to render an interactive window via matplotlib I am using an out of process script in a toolbox. If I debug the script, it is possible to step through and render the window as expected. Running it through ArcMap (not in debug mode) causes a 000714 error.



  1. Arc10.2

  2. Running the script out of process

  3. Tested with background processing on and off (Geoprocessing Options)

  4. pythonExe is being properly found



Any thoughts?


import multiprocessing
import sys, os
import arcpy

import matplotlib.pyplot as plt

def show_form():
fig = plt.figure()

x = range(10)
y = range(10)
plt.plot(x,y)
plt.show()

def main():
pythonExe = os.path.join(sys.exec_prefix, 'python.exe')
multiprocessing.set_executable(pythonExe)
multiprocessing.freeze_support = True
jobs = []

pool = multiprocessing.Pool(1)
jobs.append(pool.apply_async(show_form,[]))
pool.close()
pool.join()
del pool
del jobs
arcpy.SetParameterAsText(0, True)

if __name__ == "__main__":
main()


Update 1


As per Luke's comment, I tested cmd.exe /C test.py. Other than the long import time for arcpy the script executed as expected with the Tk plot window appearing.


Update 2


By opening a command window and quickly snapping a screen capture, I can grab an error from the script before it dies. This looks like an issue loading the libraries (32 vs. 64bit?)


enter image description here


Update 3


Arcmap is using the 64bit python by default when running out of process. The next step is to figure out how to disable this, as it appears to be causing a Tk issue as @Luke suggested.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...