Pretty much what the post title says. I have some python scripts which require background processing to be enabled, other disabled. I know this can be set in tool properties, but these are just stand alone scripts. Haven't been able to find any info one way or the other. Thanks.
Solved! Go to Solution.
You can call 64bit arcpy from a standalone script, the trick is to set PYTHONPATH to the 64bit site-packages directory then start a subprocess that inherits the environment variable and runs 64bit.
Similar to the code in this sample:
I would like to be able do disable background processing from a standalone python script, so I can run resource hungry old (9.3 era) scripts which still have some VB in them. Of course I should revise scripts (there are plenty...)
To me, "standalone python script" implies running the script outside of ArcGIS Desktop, e.g., calling a *.py file directly from a Python interpreter. Is that what you are doing, or are you wanting to run it from within ArcGIS Desktop, like from the interactive Python window?
I don't think there is anything wrong or dated with running scripts from the command line, I do it quite a bit, and I think lots of other folks do as well. Sometimes I find integrating scripts into the ArcGIS ecosystem (Python toolboxes, etc...) not worth the effort.
Anyhow, if you are running scripts from the command prompt or directly from an interpreter, i.e, not through ArcGIS client, then background processing doesn't really exist. If you have 64-bit Background Geoprocessing installed and run the script using the 64-bit Python interpreter, then the script uses 64 bit tools. If you have 64-bit Background Geoprocessing installed and run the script using the 32-bit interpreter, the script uses 32-bit tools. The Background Processing setting under Geoprocessing options applies to running scripts within the ArcGIS client (ArcMap, ArcCatalog, etc...)
Right, I have the same opinion about running scripts from commandline and I understand that the setting is for the client. However, I sometimes get an abnormal program termination (C++ runtime) when using Pyton 32 bit, so I then explicitly use C:\python26\arcgisx6410.5\python.exe. Which will give me an error when it finds anything smelling like VB.
I found arcpy.env.parallelProcessingFactor='0' (which I included in a script). I do not know if it helps, since I replaced the offending tool calls by cursor-methods.
I will certainly give it another try - when back from holiday.