[python-win32] VBScript compilation error - expected end of statement

Frank Peacock fepeacock at bulldoghome.com
Mon Nov 7 16:34:01 CET 2005


Hello

I am running a python script which calls an ESRI ArcGIS COM function called
calculatefield. If the text variable I pass to this function is longer than
10 characters I get the following error: "Microsoft VBScript compilation
error - expected end of statement". I do not know what I need to do to solve
this problem. I have installed the latest WSH 5.6 but to no avail.

The following is my code:

# --------------------------------------------------------------------------
-
# Create Time Field.py
# Created on: Sun Nov 06 2005 11:37:26 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")
gp.SetProduct("ArcView")

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

# Local variables...
gp.workspace = "C:\\GIS_DATA\\Satellite\\CLAUS\\I2-235\\"

try:
    fas=gp.ListFeatureClasses("*","POLYGON")
    fas.reset()
    fa=fas.next()
    while fa:
        text=fa[0:11]
        print text
        # Process: Calculate Field...
        gp.CalculateField_management(fa, "Time", text)
        fa=fas.next()
except:
    gp.AddMessage(gp.GetMessages(2))
    print gp.GetMessages(2)


---
[This E-mail has been scanned for viruses but it is your responsibility 
to maintain up to date anti virus software on the device that you are
currently using to read this email. ]



More information about the Python-win32 mailing list