2

I'm making a power point presentation about the differences between Python window and IDLE for my coworkers. I only use the python window to get feedback from my custom toolbars. I tried using it once to help make sense of an ArcPy function.

It wasn't worth the effort and I really didn't get anywhere. I usually save my code as a python script in IDLE. I don't want to put together a presentation that just tells my coworkers that I don't like Python Window and neither should they so I'm looking for more information on Python Window in ArcMap.

So far I have:

  • The default environment is different
  • ArcMap is only 32-bit, while IDLE can be installed as a 64-bit
  • The ArcMap instance is already started if you're using Python Window
  • You shouldn't use python window for large scripts
  • ArcPy is already imported in Python Window

I want to make this as referable as possible; my goal is to create something that makes sense by itself so that it can be used as a reference.

Are there any other differences that I've missed that I should know about?

I've read Differences between Python window and Python script tool?, but I have a hunch - or misguided hope - that there's a little bit more to it than that.

  • gis.stackexchange.com/questions/171304/… is not a duplicate but may help you when thinking in this space. – PolyGeo Jan 23 '17 at 23:54
  • Any good IDE will let you use debug mode and set breakpoints, which are invaluable. Python window will give you better intellisense with GP functions (e.g. a dropdown for field type). – Paul Jan 24 '17 at 0:17
  • IDLE supports autocompletion too: gis.stackexchange.com/a/94754/115 As far as I know the same "intellisense" as the Python window becomes available after import arcpy. – PolyGeo Jan 24 '17 at 0:24
4

I use the Python window frequently as part of my workflow. The window has expanded functionality that isn't available in IDLE. It has an auto-complete function that knows when a layer is a possible input and allows the user to select from layers in the TOC. It also knows details about various arcpy functions and provides help information automatically. When scripts are run, certain arcpy functions have progress displays in ArcGIS to allow for more feedback than is possible with IDLE, such is text and progress bars.

enter image description here

You can easily add custom functions to ArcGIS using the python window, such as this example.

I've even found that arcpy functions that occasionally randomly fail in IDLE will work in the ArcGIS python window.

The python window is good for quick scripting, it provides more feedback to the user, and it's also a bit more stable than IDLE.

3

Here are a few you haven't mentioned:

  1. Batch processing even small tasks is, in my opinion, better done in a stand-alone Python script
  2. Ability to use arcpy.mapping.MapDocument("CURRENT") in the python window

Esri provides these bits of information for the Python window and Python IDE's

The Python window is an efficient and convenient location to use geoprocessing tools and Python functionality from within ArcGIS. The Python commands run from this window can range from single lines of code to complex blocks with logic. The Python window also provides a place to access additional functionality using custom or third-party Python modules and libraries.

The Python window also acts as a gateway to Python for those new to scripting, providing an intuitive interface that makes learning Python scripting in ArcGIS as easy as possible. In the Python window, various tool and method usage and syntax can be viewed or experimented with, and snippets of Python code can be entered or pasted into the window to test scripting ideas outside a stand-alone script. The Python window is a powerful mechanism for efficiently accessing and executing geoprocessing and scripting tasks and increasing productivity by placing Python functionality within ArcGIS for Desktop applications.

Python IDEs

As there are many Python IDEs to choose from, picking the right one can very well depend on the platform you use (Windows or Linux), specific features, or the cost. At a minimum, a good IDE will have the following features:

An editor with code completion
Syntax highlighting
Code templates
A code explorer for functions and classes
Tools for unit testing and debugging
Source control support

1

A few points:

  • Both the python window and IDLE stores all variables created during each session. This can cause confusion when testing scripts.
  • The python window allows you to access the TOC of your map document.
  • The python window provides functionality that does not exist in a standalone script. Therefore, it is not the best practice to test an entire script in the python window. It is excellent for testing each portion of your script to ensure the tools do what you want.
  • IDLE is not very user friendly. I recommend using pyscripter to create and test your scripts.
  • can you give me an example of python window's storing variables causing confusion? I'm not really understanding how this is different from IDLE – user66821 Feb 14 '17 at 23:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy