[UW-GIS-L] Warning about upgrading Python to 2.4
David Finlayson
david.p.finlayson at gmail.com
Fri Mar 11 11:18:56 PST 2005
I have been getting a lot of error reports on my scripts from people
who have recently upgraded their version of Python to 2.4. The scripts
just stop working. Here is an FYI for those of you who are using
Python from ArcGIS:
There are two related problems:
1) You go to Python.org and download the Windows Python installer and
forget to also download the win32all extensions.
2) You DO download the win32all extensions but the Windows registry is
not properly updated(!)
Result:
In both cases you will see an error message that looks like this
(Fetch is the name of the script in this case):
Executing (Fetch_4): Fetch C:\temp\landgrid C:\temp\fetchgrid 150 SINGLE
Start Time: Thu Mar 10 09:35:55 2005
Running script Fetch...
Error in script Fetch.
Error in executing: cmd.exe /C C:\temp\UWWaves\fetch.py
"C:\temp\landgrid" "C:\temp\fetchgrid" "150" "SINGLE"
Failed to execute (Fetch_4).
End Time: Thu Mar 10 09:35:57 2005 (Elapsed Time: 2.00 secs)
The problem is that Python cannot connect to the COM server because of
#1 or #2 above. It has nothing to do with cmd.exe like the error
message suggests.
Here is the solution:
1) Make sure you install the win32all extension for your new version
of Python. They are calling this pywin32-2.4 or some such thing right
now (see Python.org for the links)
2) If installing doesn't fix it, you will need to update your registry
manually (get help if you haven't done this before). See the
following:
I found a discussion on this and they suggested adding the pythonwin
value to the registry (with the current build - 203 for Python2.4).
Following is a section (and solution) from that discussion.
ArcGIS looks for the python and pythonwin registry keys before running
python scripts. The later versions of pythonwin don't lay down a
registry key so ArcGIS doesn't run the scripts because it can't see
pythonwin. You can get around this by creating a pythonwin registry
key manually.
I've attached a file called "Pythonwin.txt". If you rename it to
"Pythonwin.reg" (make sure its not renamed as "Pythonwin.reg.txt") and
double click it, your registry will be updated. The file contains the
following lines of text:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Python\Pythonwin]
[HKEY_LOCAL_MACHINE\SOFTWARE\Python\Pythonwin\Build]
@="151"
You can create this file yourself by copying these lines from here to
Notepad and then saving the file with the .reg extension. Double
clicking this file will update the registry.
You shouldn't have any problems running your scripts after the
registry is updated. Look for a Knowledge Builder document to come out
on this topic in the next couple of days.
Nathan Warmerdam
ESRI
It might be worth waiting to upgrade until ESRI/Python.org iron out
what is going on.
HTH
David
--
David Finlayson
Marine Geology & Geophysics
School of Oceanography
Box 357940
University of Washington
Seattle, WA 98195-7940
USA
Office: Marine Sciences Building, Room 112
Phone: (206) 616-9407
Web: http://students.washington.edu/dfinlays
More information about the Uw-gis-l
mailing list