[python-win32] Shape file field update problem

Ahmed, Shakir shahmed at sfwmd.gov
Fri Aug 25 22:49:22 CEST 2006


HI,

I generated this python script from Arc GIS Model, tried to run from
python win but getting error. I am trying to update a text field from a
date filed data. Any help is highly appreciated.


========================================================================
====
add_field.py
# Created on: Wed Aug 23 2006 04:57:34 PM
#   (generated by ArcGIS/ModelBuilder)
#
------------------------------------------------------------------------
--
# Import system modules
import sys, string, os, win32com.client

# Create the Geoprocessor object
gp = win32com.client.Dispatch("esriGeoprocessing.GpDispatch.1")

# Load required toolboxes...
gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data
Management Tools.tbx")

#set a default workspace
gp.workspace = "V:/data/tst/shp"

# Calculating the fields to the date as a text field
gp.calculatefield_management("br_er_primary.shp", "LEGAL_CDT",
"[APP_NO]") 
#the above line works fine  
gp.calculatefield_management("br_er_primary.shp", "FINAL_CDT",
"FORMAT([final_acti],'mm/dd/yyyy')")
# this above line is not working getting the following error.

========================================================================
====

The error I am getting is as follows:
------------------------------------------------------------------------

Traceback (most recent call last):
  File "V:\data\tst\add_field.py", line 31, in ?
    gp.calculatefield_management("br_er_primary.shp", "FINAL_CDT",
"FORMAT([final_acti],'mm/dd/yyyy')")
  File "<COMObject esriGeoprocessing.GpDispatch.1>", line 2, in
calculatefield_management
com_error: (-2147467259, 'Unspecified error', None, None)


------------------------------------------------------------------------
-
Thanks in advance.
Shakir




More information about the Python-win32 mailing list