When I open the python window in either ArcMap or ArcCatalog (ArcGIS 10.1) as soon as I press a key it freezes the entire program and it crashes. It doesn't produce any warning, error, or pop up with info afterwards it just crashes. I tried searching for similar problems through the forum but none of their solutions worked. I installed Service Pack 1 and that didn't solve the problem. I can use IDLE and/or PythonWin to import Arcpy but some custom python tools won’t work. Some of those tools crash it in the same way. Has anyone experienced anything like this or have any idea on how I can get python window to work for Arc 10.1? (I have also tried uninstalling and re-installing ArcGIS 10.1)
I recommend checking whether you have another version of Python installed, besides the one installed by ArcGIS for Desktop.
From the Comments it appears that you did have another Python installed on your computer i.e. Python 2.7.5 installed in addition to Python 2.7 for ArcGIS, and once you uninstalled that everything began to work perfectly.
I came across this problem after an "IIS Web Platform" installer silently installed a separate version of Python27; uninstalling it of course didn't fix anything. Creating+running a registry patch file (i.e., text file with .reg extension) with the following contents fixed the issue for me:
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python] [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore] [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.7] [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.7\Help] [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.7\Help\Main Python Documentation] @="C:\\Python27\\ArcGIS10.1\\Doc\\python272.chm" [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.7\InstallPath] @="C:\\Python27\\ArcGIS10.1\\" [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.7\InstallPath\InstallGroup] @="Python 2.7" [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.7\Modules] [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.7\PythonPath] @="C:\\Python27\\ArcGIS10.1\\Lib;C:\\Python27\\ArcGIS10.1\\DLLs;C:\\Python27\\ArcGIS10.1\\Lib\\lib-tk"
Same issue just struck me. Python command prompt and idle work but Arc toolboxes crash. I had installed WinPython but it didn't show up on the uninstall list. Weird.
My fix was to manually go through the registry and change all Python paths to the ArcGIS path. Its sort of a one by one thing since each variant of the path is different.
Be careful with multiple pythons.
I had this issue with ArcGIS 10.4 (which uses Python 2.7.10). I have installed another Python (2.7.15) for testing Mapproxy and it made ArcMap's Python Window crash as soon as I tried to import arcpy.
I had these registry values for local machine:
- HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Python\PythonCore\2.7\Help\Main Python Documentation (C:\Python27\ArcGIS10.4\Doc\python2710.chm)
- HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Python\PythonCore\2.7\InstallPath (C:\Python27\ArcGIS10.4)
- HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Python\PythonCore\2.7\PythonPath (C:\Python27\ArcGIS10.4\Lib;C:\Python27\ArcGIS10.4\DLLs;C:\Python27\ArcGIS10.4\Lib\lib-tk)
It's just as cwa suggested, but I also had to change these as well (for current user) to point to ArcGIS's Python. I used the same values as for local machine.
- HKEY_CURRENT_USER\Software\Python\PythonCore\2.7\Help\Main Python Documentation
After these changes Python window works again.