Select to view content in your preferred language

Python update script - if feature class does not exist statement

2591
1
12-06-2010 11:23 AM
MickClifford
Deactivated User
Hi,
I have a Python data update script which grabs data from an Oracle database and puts it into feature classes in File Geodatabases.  This uses the Data Interoperability Quick Import tool.  This has been working fine for a while.  My problem now is that some data sets often have no data for periods of time, so my update script simply does not create that feature class.  This in turn causes my MXD problems, because it is missing a data link.

What I want to do is add an 'if statement' to my update that says something like "FeatureClassX does not exist, then create feature class from an empty Master template" using the Create Feature Class tool.  Else, continue on with update as Feature Class does exist.

Does anyone know if there is a way to do this in python script?  I tried using 'GetCount' but ran into errors saying things were not defined, but I think even if it were written correctly it, it probably isn't what I'm after anyway - would GetCount return a value of zero records if the feature class does not exist?

Any help with this would be greatly appreciated.  Many Thanks,

Mick
0 Kudos
1 Reply
LoganPugh
Frequent Contributor
0 Kudos