1

I am learning Python, so here is a real newbie question!

Everything writen in ArcGis Python's windows is working fine. The same lines, correctly writen in an IDE, when run, are crashing it.

Working on ArcGis 10.2 using Python 2.7.5, 32 bits, Windows 7

IDE:

PythonWin32 (pywin32-218.win32-py2.7)
PyScripter (PyScripter-v2.5.3-Setup.exe)

For PyScripter I get a message Windows Error "python.exe is not working" followed by aPyScripter message: "EOFError: [Errno 10054] An existing connection was forcibly closed by the remote host" . Internet searches didn't get an answer I could understand.

For PythonWin, it just stops and crashs.

Installations path are as followed (by default): Python 27: C:\

PythonWin: C:\Python27\ArcGIS10.2\Lib\site-packages\pythonwin

PyScripter: C:\Program Files (x86)\PyScripter

I suppose these issues have been met before and solve... So what I am missing here? some other packages or libraries? What would you advice me to use to script in Python?

For info my lines are:

import arcpy

from arcpy import env

env.workspace = "D:/_PYTHON/Python/Data/Exercise07"

fc = "Results/airports.shp"

delimfield = arcpy.AddFieldDelimiters(fc, "STATE")

cursor = arcpy.da.UpdateCursor(fc, ["STATE"], delimfield + " = 'AK'")

for row in cursor:

    row[0] = "AK2"

cursor.updateRow(row)

del row

del cursor
9
  • 1
    I think your multiple IDE installs are getting in each other's way. I think you should decide which you want to use and focus your question on getting that to work. Personally I just use IDLE that comes with the ArcGIS for Desktop install of Python and it always just works - especially for Python beginners.
    – PolyGeo
    Dec 9 '14 at 11:19
  • thanks PolyGeo, which ones are you using?
    – PMessager
    Dec 9 '14 at 11:33
  • IDLE only - it meets my requirements
    – PolyGeo
    Dec 9 '14 at 11:44
  • Shouldn't this be migrated to stackoverflow.com?
    – Graviton
    Dec 9 '14 at 11:47
  • @Graviton There's certainly a case for that if help is needed installing multiple IDEs. If IDLE is used then I think its uninstall/reinstall ArcGIS for Desktop and plain sailing.
    – PolyGeo
    Dec 9 '14 at 12:03
1

You start your question by saying:

I am learning Python, so here is a real newbie question!

and then describe your install of two Python IDEs (PyScripter and PythonWin) in addition to another IDE (IDLE) that installs as part of the Python that gets installed by ArcGIS for Desktop.

When learning any new software my recommendation is to keep your install as vanilla as possible. That way when something goes wrong there are far less places to look for its cause.

In this case I would uninstall PyScripter, PythonWin, ArcGIS for Desktop, and any vestiges of Python 2.7 and perform a simple reinstall of ArcGIS for Desktop.

This will give you access to a robust, easy-to-use and highly functional IDE in IDLE that I use for all my Python work with no problems.

After seeing how easy it is to work with IDLE as your IDE for a while, then by all means, if you think you need something more sophisticated try PyScripter, PythonWin, or other Python IDEs one at a time because by then you'll know how easy it should be to use a Python IDE based on your IDLE experience and have something to benchmark their install and use against.

3
  • I can attest that PythonWin does not break ArcGis. The other common problem is having another python install... do not install any other versions of python on a workstation that has ArcGis!! If you need another version look up Windows Virtual PC. Dec 9 '14 at 22:14
  • 2
    Great advice above from PolyGeo. Once you've cleaned up your environment, I can also recommend PythonWin as it has a good debugging environment, which allows you to step through your code line-by-line - you can also interact with the command-line while in Break mode. To my knowledge IDLE doesn't have anything as good. Ensure that you install the version of PythonWin which comes with the ArcGIS Desktop installation media. Dec 9 '14 at 22:26
  • I have already uninstalled and reinstall everything last week (through a network automatic Installation). Tried first Pythonwin32 which kept crashing and then tried Pyscripter. I followed the advices on path on [link]docs.python-guide.org/en/latest/starting/install/win and installed a PATH Variable as described in the ARCGis help. I'm going to reinstall ArcGis and Python and see what's Happening.
    – PMessager
    Dec 10 '14 at 9:20

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.