Hi everyone,
I want to use arcpy environment settings with python mutliprocessing, but using attribut 'workspace' raises the exception: "AttributeError: 'GPEnvironment' object has no attribute 'workspace'"
My code snippet from parent script:
mp_exe = os.path.join(sys.exec_prefix, 'pythonw.exe')
mp.set_executable(mp_exe)
with mp.Pool(4) as pool:
pool.starmap(
mp_update,
[("some_sde_connection_file", tbl_name) for tbl_name in tbl_names],
)
My code snippet from multiprocessing script:
import arcpy
def mp_update(cnn_file, tbl_name):
arcpy.env.workspace = cnn_file
pass
I tested bove arcpy.env.workspace and arcpy.EnvManager(Workspace=...).
The exception "AttributeError: 'GPEnvironment' object has no attribute 'workspace'" is always raised wenn das Skript als Skript-Tool in ArcGIS Pro (3.4.5) ausgeführt wird.
But the script executes successfully without an exception in my development environment (PyScripter).
Does anyone have an idea why arcpy environment settings are unavailable during multiprocessing?