Update: This has to do with my two installed Pythons (ArcGIS and EPD) -- Windows isn't finding the right one. I am going to uninstall and reinstall Python using the ArcGIS installer and report back.Update2: Uninstall and resinstall of Python using ArcGIS installer didn't help. Updated test script below. Any ideas?
[/HR]I am having problems importing arcpy or arcgisscripting when launching python through windows file associations with Arc 10.1. This may have to do with me dinking with the file associations to try to get a specific python folder to be used by ArcGIS, but I'm back to normal now. ArcGIS and IDLE seem to be finding the ArcGIS Python fine.E:\work>assoc .py
.py=Python.File
E:\work>ftype Python.File
Python.File="D:\Python27\ArcGIS10.1\python.exe" "%1" %*
Here's my test script:
import sys
print sys.version
print "hello there"
import arcpy
When I run this from windows, I get an error when I try to import arcpy because I'm getting the wrong PythonE:\work>x.py
2.7.3 |EPD 7.3-2 (32-bit)| (default, Apr 12 2012, 14:30:37) [MSC v.1500 32 bit (Intel)]
hello there
Traceback (most recent call last):
File "E:\work\x.py", line 4, in <module>
import arcpy
ImportError: No module named arcpy
However, if I specify the ArcGIS python version intepreter explictly, no problem:E:\work>"D:\Python27\ArcGIS10.1\python.exe" x.py
2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]
hello there
Here's what the file association looks like in the Windows GUI:[ATTACH=CONFIG]17634[/ATTACH]Note, my DDE setting used have the text: "%1" %*but this causing the following popup error - (so I cleared the DDE box):[ATTACH=CONFIG]17635[/ATTACH]I'm seeing this on XP64, Python 2.6, ArcGIS 10.1.