AnsweredAssumed Answered

10.1 SP1 64bit geoprocessing, error importing arcpy

Question asked by jkcp on Feb 8, 2013
Latest reply on Feb 14, 2013 by Wayne_Whitley
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

import arcpy, os, sys print "Imported arcpy, os and sys modules successfully in main script" os.system(sys.argv[0].replace('.py',''))

Here's script 2, named

import arcpy print "Imported arcpy module successfully in slave script"

I'm initiating the script by entering "X:\fullpath\" 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:

Imported arcpy, os and sys modules successfully in main script Traceback (most recent call last):   File "X:\fullpath\", line 1, in <module>     import arcpy   File "c:\program files (x86)\arcgis\desktop10.1\ArcPy\arcpy\", line 21, in <module>     from arcpy.geoprocessing import gp   File "c:\program files (x86)\arcgis\desktop10.1\ArcPy\arcpy\geoprocessing\", line 14, in <module>     from _base import *   File "c:\program files (x86)\arcgis\desktop10.1\ArcPy\arcpy\geoprocessing\", line 14, in <module>     import arcgisscripting ImportError: DLL load failed: %1 is not a valid Win32 application.

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!)