Select to view content in your preferred language

arcpy.ParseTableName returning null

767
2
09-03-2014 04:11 AM
deleted-user-tmoWMkOb1VrD
New Contributor II

I have this very simpel script

import arcpy, os

from arcpy import env

adr =r"\\gisbatch\servere\GIS-DB\GISEDIT\ADRESSE@GISEDIT.sde\GISDIST.ADRESSE.ENHED_ADR_BBR"

env.workspace = os.path.dirname(adr)

print arcpy.ParseTableName(os.path.basename(adr))

I had expected this reply "GISDIST, ADRESSE, ENHED_ADR_BBR"

But I get this "(null), (null), GISDIST.ADRESSE.ENHED_ADR_BBR"

What do I do wrong or if then, what is the purpose with the tool.

Thanks

Sebastian

Tags (2)
0 Kudos
2 Replies
DanPatterson_Retired
MVP Emeritus

don't you just want to use the os stuff instead?

>>> import os

>>> adr =r"\\gisbatch\servere\GIS-DB\GISEDIT\ADRESSE@GISEDIT.sde\GISDIST.ADRESSE.ENHED_ADR_BBR"

>>> adr

'\\\\gisbatch\\servere\\GIS-DB\\GISEDIT\\ADRESSE@GISEDIT.sde\\GISDIST.ADRESSE.ENHED_ADR_BBR'

>>> x = os.path.basename(adr)

>>> x

'GISDIST.ADRESSE.ENHED_ADR_BBR'

>>> y = os.path.dirname(adr)

>>> y

'\\\\gisbatch\\servere\\GIS-DB\\GISEDIT\\ADRESSE@GISEDIT.sde'

>>>

0 Kudos
NaimeCelik
Occasional Contributor

Hi

I think problem is related to your "adr" path , I tried one of my sde connection and it works. Try to copy your path location from catalog location after browsing your path.

catalog_location.png

0 Kudos