BUG

Syntax error raised when running a VBScript exported from a model

Last Published: April 25, 2020

Description

When running a VBScript created by exporting a model, a syntax error may be raised in certain situations. For example, a situation when a VBScript uses the Define Projection tool.

Cause

When model builder performs the export, it uses a comma as a place holder for unused parameters. If the last parameter is unused, the last comma is in violation of VBScript syntax conventions. For example:

Code:
gp.DefineProjection_management states_shp_3, "GEOGCS['GCS_North_American_1927',DATUM['D_North_American_1927
',SPHEROID['Clarke_1866',6378206.4,294.9786982]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]",


This is generally not a problem for Python scripts as the Python exporter places the geoprocessing expression parameters within parenthesis. The VBScript exporter does not. Note that this problem has been resolved in ArcGIS 9.0 sp3 and ArcGIS 9.1.

Workaround

Edit the script to remove all unnecessary commas.
  • Option 1

    1. Open the script in Python editor.

    Note:
    Right-click the script within ArcToolBox and click edit.

    2. Remove any comma that appears at the end of a geoprocessing expression.

    3. Save the edit.

  • Option 2

    1. Open the script in NotePad or WordPad.

    2. Remove any comma that appears at the end of a geoprocessing expression.

    3. Save the edit.

    For example, the Define Projection example above would look like:

    Code:
    gp.DefineProjection_management states_shp_3, "GEOGCS['GCS_North_American_1927',DATUM['D_North_American_1927
    ',SPHEROID['Clarke_1866',6378206.4,294.9786982]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]"

Article ID:000007512

Software:
  • ArcMap 9 x

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic