[GIS] Can’t import arcpy in IDLE, pyscripter, or even ArcGIS10.1’s Python window

arcgis-10.1arcpyinstallation

After using arcpy and python for months with ArcGIS 10.1 without any problems I'm encountering something I can't work around or even find help with online. Something as simple as "import arcpy" is failing for no reason I can think of:

>>> import arcpy
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
  File "C:\Program Files\ArcGIS\Desktop10.1\arcpy\arcpy\__init__.py", line 24, in <module>
    from arcpy.toolbox import *
  File "C:\Program Files\ArcGIS\Desktop10.1\arcpy\arcpy\toolbox.py", line 342, in <module>
    from management import Graph, GraphTemplate
  File "C:\Program Files\ArcGIS\Desktop10.1\arcpy\arcpy\management.py", line 153
SyntaxError: Non-ASCII character '\xe2' in file C:\Program Files\ArcGIS\Desktop10.1\arcpy\arcpy\management.py on line 154, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

I've looked around and I've seen other people with similar symptomes but nothing with the same last message, the Non-ASCII character '\xe2' in file C:\Program Files\ArcGIS\Desktop10.1\arcpy\arcpy\management.py on line 154, but no encoding declared; part seems different.

I haven't done anything like installing new python extensions or versions or any other type of software. The only thing remotely related was that I had an FME process working in the background while I was testing my code. I didn't modify any pre-existing ArcGIS python scripts.

I have tried using IDLE installed by ArcGIS 10.1, pyscripter, and the Python window that can be opened inside of ArcGIS. I tried rebooting on the off chance it was some fluke. The only thing I can think of to try next is a fresh instal, and if that doesn't work maybe going as extreme as wiping the PC's OS and starting over from scratch.

Any help would be greatly appreciated.

Best Answer

For me a basic uninstall/reinstall of ArcGIS 10.1 is relatively painless taking perhaps 30 mins in total, so as @JasonScheirer says I would try that for a possible quick fix - but take care if your install has lots installed on top of it.

If you have not read the bottom of this page from the Online Help about Paths and Import it may be worth doing so (although it may not be related to this specific problem).