Error with arcpy module

935
5
06-22-2012 06:30 AM
NickMeyers
New Contributor
I am having an issue with the arcpy module not working in Python.  I have been using Python scripts for the past 4 months and just last week the arcpy module stopped working.


Here is the error I receive.

>>> import arcpy
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
ImportError: No module named arcpy
Tags (2)
0 Kudos
5 Replies
JoshuaChisholm
Occasional Contributor III
Strange. That's the error you'd get if you didn't have ArcGIS installed on the machine. A few questions.
1) Does ArcMap start up normally?
2) Does 'import os' work?
3) Does 'import arcpy' work in the python window of ArcMap?
You could try checking to make sure your python shell has access to the arcpy directory.
0 Kudos
JoannaWhittier
New Contributor III
I am having the same problem in IDLE and it started after loading the pre-release for 10.1.  I followed the directions to make sure the pathways in the Desktop10.1.pth file were correct as indicated on this site (http://resources.arcgis.com/en/help/main/10.1/index.html#//002z00000008000000) but that did not help.  I rebooted just in case but that did not resolve anything.  I have searched various online sites but have not found any other solution.  In IDLE import os works.  Import arcpy does work in the python window of ArcCatalog.  How would I check to see if the IDLE Python shell has access to the arcpy directory?
0 Kudos
JoannaWhittier
New Contributor III
Are you running the python script in IDLE?  Is it possible that a newer version of Python was installed?  If you are using a shell to run the python script, check the pathways that are being used (in the IDLE shell, look under the File menu for path browser).  I ran into a problem after upgrading to 10.1 but when I opened a .py file, my computer defaulted to python 2.6 instead of python 2.7 which is used by 10.1.
0 Kudos
JoshuaChisholm
Occasional Contributor III
I actually just ran into this problem on a public computer yesterday. For some reason there were two copies of IDLE on the system. The one under 'Start>Program Files>Python26' wouldn't "import arcpy", but the one under 'Start>Program Files>ArcGIS>...>IDLE (Python GUI)' did work.
Just a quick something to try out. Good luck, and let us know if you get it working or not!
0 Kudos
NickMeyers
New Contributor
I resolved the issue by doing a complete uninstall and reinstall.
0 Kudos