Select to view content in your preferred language

error running simple python script outside of ArcMap

1818
6
06-25-2010 07:22 AM
RachelS
Frequent Contributor
HI,
I created a model using a sample script which runs fine in ArcMap to create a backup of a feature class in another geodatabase but when I export it to python script and run it I get the error:
Failed to execute. parameters are not vaild. Input feature class does not exist or is not supported.

My code is:
# BackupSeizures.py
# Created on: Fri Jun 25 2010 04:22:08 PM
#   (generated by ArcGIS/ModelBuilder)
# ---------------------------------------------------------------------------

# Import system modules
import sys, string, os, arcgisscripting

# Create the Geoprocessor object
gp = arcgisscripting.create()

# Load required toolboxes...
gp.AddToolbox("C:/ESRIIreland/Add_ons/ExportFeatureClasswithDate/Toolbox.tbx")


# Local variables...
Seizures_DBO_Seizures = "Seizures.DBO.Seizures"
Backups__VERSION_DBO_DEFAULT_ = "Database Servers\\LASRV-GIS_SQLEXPRESS.gds\\Backups (VERSION:DBO.DEFAULT)"

# Process: Feature Class To Feature Class With Date...
gp.toolbox = "C:/ESRIIreland/Add_ons/ExportFeatureClasswithDate/Toolbox.tbx";
gp.FeatureClassToFeatureClassWithDate(Seizures_DBO_Seizures, Backups__VERSION_DBO_DEFAULT_, "Seizures")

I can't see where I'm going wrong, I'm new to this so any help much appreciated.
I'm using ArcEditor Version 9.3.1.
Rachel
0 Kudos
6 Replies
ChrisMathers
Deactivated User
Take a look at this line. It may be as simple as navigating to this data in catalog and copying the path from the top of the window. Code exports from MB are screwy and things like paths can sometimes get messed up as a path within ArcMap can be treated specially if the data was added to the model from ArcMap Table of Contents instead of navigated directly to.
Backups__VERSION_DBO_DEFAULT_ = "Database Servers\\LASRV-GIS_SQLEXPRESS.gds\\Backups (VERSIONBO.DEFAULT)"
0 Kudos
RachelS
Frequent Contributor
HI Chris,
Thanks for this, I've discovered it was the line above: Seizures, it didn't export the path of the INput Feature class and it works now that I have added it.
I have a new problem now, where the task scheduler won't run the python script in Server 2008.
Any ideas much appreciated.
Rachel
0 Kudos
ChrisMathers
Deactivated User
Is python installed on the server? Silly question I know but I only ask because of personal experience.
0 Kudos
RachelS
Frequent Contributor
HI Chris,
Yes python is installed on the server.
I can run the bat file and it works outside of Task Scheduler but when I run it in scheduler it appearsto run but doesn't create the end file in the SQLgeodatabase.
I have full admin rights on the server.
Rachel
0 Kudos
ChrisMathers
Deactivated User
You have this saved as a BAT? Have you tried saving and running the task as a PY? Im sorry Im not much help with this. I dont have much experience with Server.
0 Kudos
RachelS
Frequent Contributor
HI,
I tried running the python script direct and also creating a bat file and running it within that.
It opens the python window seems to run fine but doesn't put the end feature class in the geodatbase what it's supposed to do.
I wonder does it have anything to do with arcadmin permissions although I have full admin permissions. Or is there a bug in Server 2008.
Rachel
0 Kudos