AnsweredAssumed Answered

arcpy.Exists() with Enterprise sometimes works sometimes dont

Question asked by DemersM on Jul 12, 2019
Latest reply on Jul 12, 2019 by bixb0012

Hello,

 

I would like to understand why sometimes arcpy.Exists() return True sometime False depending how I write the path of the featureClass.

 

I have two databases with both a copy of the same featureClass

 

In database1, the featureClass Archives.DBO.Data1 is in the dataset Archives.DBO.Dataset1

In database2 the featureClass PROD.SDE.Data1 is in the dataset PROD.SDE.Dataset1

 

With arcpy, if I only keep the short names of the dataset and featureClass in the path arcpy.Exists() return True for database1 but False for database2:

 

import arcpy, os

FC_DB1 = os.path.join(r"C:\\", "Connexion", "Database1.sde", "Dataset1", "Data1")
FC_DB2 = os.path.join(r"C:\\", "Connexion", "Database2.sde", "Dataset1", "Data1")

arcpy.Exists(FC_DB1)
#return True

arcpy.Exist(FC_DB2)
#return False

 

If I write the full dataset and featureClass with database2, arcpy.Exist() return True

 

import arcpy, os

FC_DB2 = os.path.join(r"C:\\", "Connexion", "Database2.sde", "PROD.SDE.Dataset1", "PROD.SDE.Data1")

arcpy.Exist(FC_DB2)
#return True

 

Why writing the short dataset and featureClass works for the database1 but not for the database2?

Outcomes