Select to view content in your preferred language

Can't run python stand-alone since upgrading to 10.1

2409
10
06-14-2013 02:01 PM
ThomasDilts
Frequent Contributor
Hi,

I'm able to run scripts as tools in ArcToolbox but I can't seem to run them from IDLE directly since upgrading to 10.1.  Initially I had SP1 for background geoprocessing but have since rolled that back thinking that it might help.  The same problem occurs.  I get the following error in IDLE:

Python 2.7.3 |EPD 7.3-2 (64-bit)| (default, Apr 12 2012, 15:20:16) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>

Traceback (most recent call last):
  File "X:\for_tdilts\outbox\GIS_tools_scripts\ClimaticWaterDeficit\Version10_1\extras\DurCWD_normal.py", line 6, 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 it that ArcGIS somehow is managing to point to 64 bit python but IDLE needs to be directed there?  Is there some sort of document with instructions that I need to be following for "post-install" of ArcGIS Desktop???

-Tom
Tags (2)
0 Kudos
10 Replies
curtvprice
MVP Alum
Thanks Stuart,

This helps a lot, and your explanation is very clear.  I'm in the process of re-installing right now and will set the PATH and PYTHONHOME variables.  I had installed the Enthought for python and had forgotten that I had it on my computer.  Prior to uninstalling I had tried just changing the the PATH and PYTHONHOME variables, but that alone didn't end up doing the trick.  If I'm understanding what you're saying correctly if I want to run 64bit python for scripts outside of ArcGIS I should simply be able to change the PATH and PYTHONHOME variables temporarily to point them to the 64 bit version?

-Tom


Tom, currently EPD and ArcGIS are lined up with versions. We have had good luck accessing arcpy from EPD and EPD from arcpy by doing this, and avoiding all the environment variable stuff, which can get your wrapped around the axle in Windows.

1. allow EPD scripts to import arcpy

copy
C:\Python27\ArcGIS10.1\lib\site-packages\Desktop10.1.pth
to
C:\Python27\epd32\lib\site-packages\zzDesktop10.1.pth  (use your EPD install folder)

and

2. allow arc python scripts to import epd modules

create a file
C:\Python27\ArcGIS10.1\lib\site-packages\zzEPD.pth
including the path
C:\Python27\epd32\lib\site-packages

The use of the "zz" prefix is to control the order to make sure the "native" libraries to that environment are loaded first.
0 Kudos