# Edit script of Python Script Tool using IDLE from ArcGIS Desktop opening three Python Shell windows?

IDLE does not open properly in my ArcGIS Desktop 10.6 (Win 10 64 bit). I set the Geoprocessing Editor with following

C:\Python27\ArcGIS10.6\Lib\idlelib\idle.pyw

When I right-click a script tool in ArcCatalog and then select Edit, 3 instances of IDLE open and none of them have opened the file.

I think it is a path problem. The path is on a Windows network drive:

K:\Me K\Program Resources\ArcGIS\Arcgis10.1

and the 3 instances are

• K:\Me
• K:\Me K\Program
• K:\Me K\Program Resources\ArcGIS\Arcgis10.1\K

My guess is the idle.pyw script split the path at spaces, got 3 members and ran an accumulation of each in succession, creating 3 IDLE windows of different parts of the path. But why would it even do that?

Even then, there is the strange wrap around with the \K.

Either way, it does not work as required. Does anyone have any ideas?

Update: I followed advice to uninstall 10.6 and python and then reinstall. It still opens 3 IDLE windows, but now the file paths have a new component:

• K:\Me
• C:\windows\System32\K\Program
• C:\windows\System32\Resources\ArcGIS\Arcgis10.1\file.py

Trying with Notepad++ as Editor and the same errors persist:

• "K:\Me" does not exist

• "C:\windows\System32\K\Program" does not exist

• "C:\windows\System32\Resources\ArcGIS\Arcgis10.1\file.py" cannot be opened

It is not Python but ArcGIS 10.6.1 sending the erroneous path strings.

This is normal script making in ArcCatalog I have done for years in 9.x and earlier 10.x.

• As an expedient you may want to consider uninstalling ArcGIS Desktop and your Python 2.7.x, and then reinstall ArcGIS Desktop while allowing it to perform its own install of Python 2.7.x.
– PolyGeo
Sep 16 '19 at 5:22
• Where and how do you click on a script? Do you use the path under C:.\Python27 or on the network drive? I didn't understand what your drive k: is doing, while python is already under C:\? At least, to call IDLE you need a command like this one: C:\Python27\ArcGIS10.6\pythonw.exe "C:\Python27\ArcGIS10.7\Lib\idlelib\idle.pyw" Sep 16 '19 at 9:21
• @Andreas Muller - Opening in ArcCatalog (now added to the Question). My network drive stores my scripts, Python is installed locally. Sep 17 '19 at 1:52
• I see from your update that you're talking about editing the Python script used for a python script tool within a toolbox, rather than directly accessing Python scripts. Thanks for the clarification. I have made some minor edits to your question to clarify this point. Sep 17 '19 at 4:25

I've worked around the space-in-path problem in ArcMap 10.6 by writing a batch file that wraps the file path passed from ArcMap in parens and calls the chosen editor (PyScripter in my case) with that wrapped file path. The batch file, named "LaunchPyScripter.bat", contains a single line:

"C:\Program Files (x86)\PyScripter\PyScripter.exe" "%*"

In ArcMap's top level menus, select Geoprocessing/Options, then set the editor to call the batch file:

Note: You have to put the batch file itself (C:\ee\launchpyscripter.bat) in a path that has no spaces!

In the picture I've left the debugger path as I'd originally set it (C:\Program Files (x86)\PyScripter\PyScripter.exe). I don't want to claim that you can use the same batch file there, I haven't yet gotten the debug option to work from within ArcMap.

Change the location of your scripts, or rename the parent directories and script name so that no spaces are included.

If you search this site, and the internet in general, you will find numerous posts related to ArcGIS having various problems with spaces in paths.

I have just tried changing one of my script tools to point to a script with spaces in it's parent directory name, and now the edit function doesn't work. It just opens my preferred editor (PyScripter) without the script included. If I change it back to the original script path, it works as expected.

I cannot find anything from ESRI saying that the edit function doesn't work with spaces in the script path, but ArcGIS space-in-path problems are well documented in various user-experiences about the web.

I expect that ArcGIS is simply passing the data to your editor (IDLE) as-is (so that spaces are interpreted as argument separators), and therefore your editor (correctly) interprets this as being passed several scripts. ArcGIS should be wrapping the path in double quotes when passing it to another process, but it appears that it does not.