I have a Python script that uses the subprocess module to call another script using subprocess.call(). The code works well when run from PythonWin, but if I import the parent script into ArcToolbox and run it from there I get some odd errors.
If the parent script is run "out of process" I get the following:
Attribute Error: Object: Environment <workspace> not found
If it's run "in process" I get:
The subprocess script returned a non-zero exit code.
The second error message is quite difficult to de-bug, as everything runs fine from PythonWin/IDLE - it's only from ArcToolbox that I have trouble. Does anyone have any idea what might be causing the first error message?
The folder that I'm trying to set as a workspace does exist, so I can't think why it's "not found". Is it possible that there's some kind of conflict between the default environment settings in ArcToolbox and the environment settings that I try to use in my subprocess?
I originally assumed that when I ran a script "out of process" ArcToolbox would simply start Python.exe and pass it the input parameters. It's obviously a bit more complicated than this though as the script works fine when run from the command line. What else is going on that I'm missing?
Any suggestions gratefully received. Thanks!