This error only occurs when using the 64bit python.exe that is installed with the SP1 for 64bit geoprocessing. And it only occurs when importing the arcpy module in a python script that is called from within another python script. I am using Windows 2008 Server R2 and ArcGIS Desktop 10.1 and the Python 2.7 that is installed with it.
Here's script 1, named test.py:
Here's script 2, named test_slave.py:
I'm initiating the test.py script by entering "X:\fullpath\test.py" at the Windows command prompt.
In the past, in 32bit before installing SP1, this runs with no problem. Now, after installing SP1 and switching the Windows association with the .py extension to the 64bit python.exe, this is what I get:
And in fact, when I switch the Windows association with the .py extension back to the 32bit python.exe, I continue to get this error, until I uninstall SP1 for 64bit geoprocessing.
Is this a bug, or is there some workaround I can employ to get this working under 64bit? (Please don't recommend that I rewrite all my scripts to not call scripts from within scripts!)
Here's script 1, named test.py:
Code:
import arcpy, os, sys
print "Imported arcpy, os and sys modules successfully in main script"
os.system(sys.argv[0].replace('.py','_slave.py'))
Code:
import arcpy
print "Imported arcpy module successfully in slave script"
In the past, in 32bit before installing SP1, this runs with no problem. Now, after installing SP1 and switching the Windows association with the .py extension to the 64bit python.exe, this is what I get:
Code:
Imported arcpy, os and sys modules successfully in main script
Traceback (most recent call last):
File "X:\fullpath\test_slave.py", line 1, in <module>
import arcpy
File "c:\program files (x86)\arcgis\desktop10.1\ArcPy\arcpy\__init__.py", line 21, in <module>
from arcpy.geoprocessing import gp
File "c:\program files (x86)\arcgis\desktop10.1\ArcPy\arcpy\geoprocessing\__init__.py", line 14, in <module>
from _base import *
File "c:\program files (x86)\arcgis\desktop10.1\ArcPy\arcpy\geoprocessing\_base.py", line 14, in <module>
import arcgisscripting
ImportError: DLL load failed: %1 is not a valid Win32 application.
Is this a bug, or is there some workaround I can employ to get this working under 64bit? (Please don't recommend that I rewrite all my scripts to not call scripts from within scripts!)