ERROR 000725: Layer Name or Table View: Dataset XXX already exists.

1400
1
07-29-2011 08:59 PM
CiroPabón
New Contributor II
Hi, I'm new to scripting.

I'm trying to write a simple script to make a route event layer. This is what I've got so far:

import arcgisscripting
gp = arcgisscripting.create(9.3)

try:

    gp.Workspace = "C:/MapaCundinamarca"
    rt = "Route.shp"
    rid = "COD_VIA"
    tbl = "tabla.dbf"
    props = "COD_VIA POINT ABSCISA"
    lyr = "Fotob"
    gp.AddToolbox("C:/Program Files (x86)/ArcGIS/ArcToolBox/Toolboxes/Linear Referencing Tools.tbx")

    gp.MakeRouteEventLayer_lr (rt, rid, tbl, props, lyr, "#") # HERE IS WHERE THE PROGRAM STOPS

except:
    print gp.GetMessages(2)

However, I get this error message:

>>> Failed to execute. Parameters are not valid.
ERROR 000725: Layer Name or Table View: Dataset Fotob already exists.
Failed to execute (MakeRouteEventLayer).

As I almost copied literally the example provided with this tool in ArcGis, changing only the names of the files and inserting the instruction to add the toolbox tool for Linear Referencing, after the script declared that "the route source could not be created".

Of course, I'm pretty sure that the Layer or Table with that name (Fotob) does not exist. I've tried to change that name before running the script to no avail.

Any ideas?

Thanks in advance to any generous soul who can help me. I haven't been able to find an example of Route Event construction besides the one given in the generic ArcGis help.
Tags (2)
0 Kudos
1 Reply
CiroPabón
New Contributor II
I added a couple of lines and now it works. I had to import the os library.
0 Kudos