Path for table shows as not existing.

107
2
Jump to solution
08-18-2022 07:22 AM
RPGIS
by
Regular Contributor

Hi,

I ran a few tests to see if a table exists in geodatabase. For some reason the script returns false despite having a proper path and everything. All other features can be accounted for but I don't know why this path is not returning.

 

import os
import arcpy

Table = # Insert table path
workspace = # Insert workspace path
if os.path.exists(Table):
    print ('{} exist'.format(Table))
else:
    print ('{} does not exist'.format(Table))

walk = arcpy.da.Walk(workspace, 'Table')

for root, directory, filenames in walk:
    for file in filenames:
        print (file)
        path = os.path.join(root, file)
        print (os.path.exists(path))

 

There is an actual path to the table but for some reason it doesn't seem to appear. The table also has attachments enabled but I don't know if this impacts whether or not the file exists. Here is the print result that I get.

 

C:\**\OverflowReportAtt does not exist
OverflowReportAtt
False
OverflowReportAtt__ATTACH
False
OverflowReportAtt__ATTACHREL
False

 

I would greatly appreciate any help on this. If this is a bug, then I will report as such.

0 Kudos
1 Solution

Accepted Solutions
JeffK
by MVP Regular Contributor
MVP Regular Contributor

Maybe try using arcpy's Exists function for the tables.

View solution in original post

0 Kudos
2 Replies
JeffK
by MVP Regular Contributor
MVP Regular Contributor

Maybe try using arcpy's Exists function for the tables.

0 Kudos
RPGIS
by
Regular Contributor

Well that worked. I don't know why the file explorer method didn't work but I guess this is a specific file structure that is unique to ArcGIS which probably explains why it didn't recognize it.

Thanks @JeffK.

0 Kudos