arcpy.Exists() with Enterprise sometimes works sometimes dont

404
1
Jump to solution
07-12-2019 06:59 AM
MaximeDemers
Occasional Contributor III

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?

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JoshuaBixby
MVP Esteemed Contributor

The GeoNet Resource Hub space is for questions and issues about GeoNet itself.  I am sharing with Python‌ and Geodatabase‌.

View solution in original post

1 Reply
JoshuaBixby
MVP Esteemed Contributor

The GeoNet Resource Hub space is for questions and issues about GeoNet itself.  I am sharing with Python‌ and Geodatabase‌.