Distinguishing between Layers and TableView using ArcPy? Planned maintenance scheduled April...

What helicopter has the most rotor blades?

Was the pager message from Nick Fury to Captain Marvel unnecessary?

Noise in Eigenvalues plot

Why not use the yoke to control yaw, as well as pitch and roll?

malloc in main() or malloc in another function: allocating memory for a struct and its members

One-one communication

Statistical analysis applied to methods coming out of Machine Learning

Why can't fire hurt Daenerys but it did to Jon Snow in season 1?

How to ask rejected full-time candidates to apply to teach individual courses?

Why did Bronn offer to be Tyrion Lannister's champion in trial by combat?

How do I find my Spellcasting Ability for my D&D character?

First paper to introduce the "principal-agent problem"

New Order #6: Easter Egg

Should man-made satellites feature an intelligent inverted "cow catcher"?

Why does BitLocker not use RSA?

How can I list files in reverse time order by a command and pass them as arguments to another command?

Fit odd number of triplets in a measure?

3D Masyu - A Die

Getting representations of the Lie group out of representations of its Lie algebra

Is there a verb for listening stealthily?

Can gravitational waves pass through a black hole?

What are some likely causes to domain member PC losing contact to domain controller?

Why are current probes so expensive?

Short story about astronauts fertilizing soil with their own bodies



Distinguishing between Layers and TableView using ArcPy?



Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Inserting DATAFRAME_ELEMENT value into dynamically generated shapefile containing its extent?Changing Symbology of Multiple Layers using ArcMap/ArcPy?Measuring minimum distance between objects in two layers using ArcPy?Where clause problems when all parts are user input variablesChange ArcSDE data source for mxds in specific folder using ArcPy?Distinguishing between table and FC using arcpy, when exporting from SDETrouble renaming layers using arcpyWriting ArcGIS Python Script Tool?ValueError error from lyr.replaceDataSource()?Distinguishing between invalid raster files and valid ones at using arcpy functions





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







2















I am working with ArcMap and am using ArcPy.



My task is to loop through mxds and find broken data sources.



My code is:



mxd = arcpy.mapping.MapDocument(fullPath)
brknMXD = arcpy.mapping.ListBrokenDataSources(mxd)
for brknItem in brknMXD:
if brknItem.supports("workspacePath"):
try:
source = brknItem.workspacePath
print str(brknItem) + ": " + source
except:
print "unexpected error"
continue
else:
print "Layer does not support source"


Some mxds have TableViews and that is where the code breaks.




Traceback (most recent call last): File
"P:ScriptsFind_MXDs_Broken_Sources.py", line 5, in
if brknItem.supports("workspacePath"): AttributeError: 'TableView' object has no attribute 'supports'




I checked within an mxd python interpreter to see what type of objects are return by arcpy.mapping.ListBrokenDataSources(mxd) and it indicated:



>>> for each in brknMXD:
... print type(each)
...
<class 'arcpy._mapping.Layer'>
<class 'arcpy._mapping.Layer'>
<class 'arcpy._mapping.Layer'>
<class 'arcpy._mapping.TableView'>


Clearly I can just set a test to distinguish between these two types, but I don't know how exactly to write it.



Any ideas?










share|improve this question
















bumped to the homepage by Community 2 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 2





    You could use the describe statement resources.arcgis.com/en/help/main/10.2/index.html#//… and look at the dataType, it should be Layer or TableView for the two indicated types, though I'm not sure how well it works with broken objects... give it a go and see what you get: if arcpy.Describe(brknItem).dataType == 'Layer': before .supports(.. line.

    – Michael Stimson
    Feb 12 '18 at 23:24






  • 1





    You can use listLayers and listTables and check if each one is broken Or as noted above, check the type before .supports

    – Ben S Nadler
    Feb 13 '18 at 6:10




















2















I am working with ArcMap and am using ArcPy.



My task is to loop through mxds and find broken data sources.



My code is:



mxd = arcpy.mapping.MapDocument(fullPath)
brknMXD = arcpy.mapping.ListBrokenDataSources(mxd)
for brknItem in brknMXD:
if brknItem.supports("workspacePath"):
try:
source = brknItem.workspacePath
print str(brknItem) + ": " + source
except:
print "unexpected error"
continue
else:
print "Layer does not support source"


Some mxds have TableViews and that is where the code breaks.




Traceback (most recent call last): File
"P:ScriptsFind_MXDs_Broken_Sources.py", line 5, in
if brknItem.supports("workspacePath"): AttributeError: 'TableView' object has no attribute 'supports'




I checked within an mxd python interpreter to see what type of objects are return by arcpy.mapping.ListBrokenDataSources(mxd) and it indicated:



>>> for each in brknMXD:
... print type(each)
...
<class 'arcpy._mapping.Layer'>
<class 'arcpy._mapping.Layer'>
<class 'arcpy._mapping.Layer'>
<class 'arcpy._mapping.TableView'>


Clearly I can just set a test to distinguish between these two types, but I don't know how exactly to write it.



Any ideas?










share|improve this question
















bumped to the homepage by Community 2 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 2





    You could use the describe statement resources.arcgis.com/en/help/main/10.2/index.html#//… and look at the dataType, it should be Layer or TableView for the two indicated types, though I'm not sure how well it works with broken objects... give it a go and see what you get: if arcpy.Describe(brknItem).dataType == 'Layer': before .supports(.. line.

    – Michael Stimson
    Feb 12 '18 at 23:24






  • 1





    You can use listLayers and listTables and check if each one is broken Or as noted above, check the type before .supports

    – Ben S Nadler
    Feb 13 '18 at 6:10
















2












2








2








I am working with ArcMap and am using ArcPy.



My task is to loop through mxds and find broken data sources.



My code is:



mxd = arcpy.mapping.MapDocument(fullPath)
brknMXD = arcpy.mapping.ListBrokenDataSources(mxd)
for brknItem in brknMXD:
if brknItem.supports("workspacePath"):
try:
source = brknItem.workspacePath
print str(brknItem) + ": " + source
except:
print "unexpected error"
continue
else:
print "Layer does not support source"


Some mxds have TableViews and that is where the code breaks.




Traceback (most recent call last): File
"P:ScriptsFind_MXDs_Broken_Sources.py", line 5, in
if brknItem.supports("workspacePath"): AttributeError: 'TableView' object has no attribute 'supports'




I checked within an mxd python interpreter to see what type of objects are return by arcpy.mapping.ListBrokenDataSources(mxd) and it indicated:



>>> for each in brknMXD:
... print type(each)
...
<class 'arcpy._mapping.Layer'>
<class 'arcpy._mapping.Layer'>
<class 'arcpy._mapping.Layer'>
<class 'arcpy._mapping.TableView'>


Clearly I can just set a test to distinguish between these two types, but I don't know how exactly to write it.



Any ideas?










share|improve this question
















I am working with ArcMap and am using ArcPy.



My task is to loop through mxds and find broken data sources.



My code is:



mxd = arcpy.mapping.MapDocument(fullPath)
brknMXD = arcpy.mapping.ListBrokenDataSources(mxd)
for brknItem in brknMXD:
if brknItem.supports("workspacePath"):
try:
source = brknItem.workspacePath
print str(brknItem) + ": " + source
except:
print "unexpected error"
continue
else:
print "Layer does not support source"


Some mxds have TableViews and that is where the code breaks.




Traceback (most recent call last): File
"P:ScriptsFind_MXDs_Broken_Sources.py", line 5, in
if brknItem.supports("workspacePath"): AttributeError: 'TableView' object has no attribute 'supports'




I checked within an mxd python interpreter to see what type of objects are return by arcpy.mapping.ListBrokenDataSources(mxd) and it indicated:



>>> for each in brknMXD:
... print type(each)
...
<class 'arcpy._mapping.Layer'>
<class 'arcpy._mapping.Layer'>
<class 'arcpy._mapping.Layer'>
<class 'arcpy._mapping.TableView'>


Clearly I can just set a test to distinguish between these two types, but I don't know how exactly to write it.



Any ideas?







arcpy arcmap






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 12 '18 at 23:46









PolyGeo

54.1k1782246




54.1k1782246










asked Feb 12 '18 at 23:05









lidalida

728




728





bumped to the homepage by Community 2 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 2 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.










  • 2





    You could use the describe statement resources.arcgis.com/en/help/main/10.2/index.html#//… and look at the dataType, it should be Layer or TableView for the two indicated types, though I'm not sure how well it works with broken objects... give it a go and see what you get: if arcpy.Describe(brknItem).dataType == 'Layer': before .supports(.. line.

    – Michael Stimson
    Feb 12 '18 at 23:24






  • 1





    You can use listLayers and listTables and check if each one is broken Or as noted above, check the type before .supports

    – Ben S Nadler
    Feb 13 '18 at 6:10
















  • 2





    You could use the describe statement resources.arcgis.com/en/help/main/10.2/index.html#//… and look at the dataType, it should be Layer or TableView for the two indicated types, though I'm not sure how well it works with broken objects... give it a go and see what you get: if arcpy.Describe(brknItem).dataType == 'Layer': before .supports(.. line.

    – Michael Stimson
    Feb 12 '18 at 23:24






  • 1





    You can use listLayers and listTables and check if each one is broken Or as noted above, check the type before .supports

    – Ben S Nadler
    Feb 13 '18 at 6:10










2




2





You could use the describe statement resources.arcgis.com/en/help/main/10.2/index.html#//… and look at the dataType, it should be Layer or TableView for the two indicated types, though I'm not sure how well it works with broken objects... give it a go and see what you get: if arcpy.Describe(brknItem).dataType == 'Layer': before .supports(.. line.

– Michael Stimson
Feb 12 '18 at 23:24





You could use the describe statement resources.arcgis.com/en/help/main/10.2/index.html#//… and look at the dataType, it should be Layer or TableView for the two indicated types, though I'm not sure how well it works with broken objects... give it a go and see what you get: if arcpy.Describe(brknItem).dataType == 'Layer': before .supports(.. line.

– Michael Stimson
Feb 12 '18 at 23:24




1




1





You can use listLayers and listTables and check if each one is broken Or as noted above, check the type before .supports

– Ben S Nadler
Feb 13 '18 at 6:10







You can use listLayers and listTables and check if each one is broken Or as noted above, check the type before .supports

– Ben S Nadler
Feb 13 '18 at 6:10












1 Answer
1






active

oldest

votes


















0














As commented by @MichaelStimson:




You could use the describe statement
http://resources.arcgis.com/en/help/main/10.2/index.html#//03q30000001w000000
and look at the dataType, it should be Layer or TableView for the two
indicated types, though I'm not sure how well it works with broken
objects... give it a go and see what you get: if
arcpy.Describe(brknItem).dataType == 'Layer': before .supports(..
line.




and as commented by @BenSNadler:




You can use listLayers and listTables and check if each one is broken
Or as noted above, check the type before .supports







share|improve this answer
























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "79"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f271220%2fdistinguishing-between-layers-and-tableview-using-arcpy%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    As commented by @MichaelStimson:




    You could use the describe statement
    http://resources.arcgis.com/en/help/main/10.2/index.html#//03q30000001w000000
    and look at the dataType, it should be Layer or TableView for the two
    indicated types, though I'm not sure how well it works with broken
    objects... give it a go and see what you get: if
    arcpy.Describe(brknItem).dataType == 'Layer': before .supports(..
    line.




    and as commented by @BenSNadler:




    You can use listLayers and listTables and check if each one is broken
    Or as noted above, check the type before .supports







    share|improve this answer




























      0














      As commented by @MichaelStimson:




      You could use the describe statement
      http://resources.arcgis.com/en/help/main/10.2/index.html#//03q30000001w000000
      and look at the dataType, it should be Layer or TableView for the two
      indicated types, though I'm not sure how well it works with broken
      objects... give it a go and see what you get: if
      arcpy.Describe(brknItem).dataType == 'Layer': before .supports(..
      line.




      and as commented by @BenSNadler:




      You can use listLayers and listTables and check if each one is broken
      Or as noted above, check the type before .supports







      share|improve this answer


























        0












        0








        0







        As commented by @MichaelStimson:




        You could use the describe statement
        http://resources.arcgis.com/en/help/main/10.2/index.html#//03q30000001w000000
        and look at the dataType, it should be Layer or TableView for the two
        indicated types, though I'm not sure how well it works with broken
        objects... give it a go and see what you get: if
        arcpy.Describe(brknItem).dataType == 'Layer': before .supports(..
        line.




        and as commented by @BenSNadler:




        You can use listLayers and listTables and check if each one is broken
        Or as noted above, check the type before .supports







        share|improve this answer













        As commented by @MichaelStimson:




        You could use the describe statement
        http://resources.arcgis.com/en/help/main/10.2/index.html#//03q30000001w000000
        and look at the dataType, it should be Layer or TableView for the two
        indicated types, though I'm not sure how well it works with broken
        objects... give it a go and see what you get: if
        arcpy.Describe(brknItem).dataType == 'Layer': before .supports(..
        line.




        and as commented by @BenSNadler:




        You can use listLayers and listTables and check if each one is broken
        Or as noted above, check the type before .supports








        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 4 '18 at 8:40









        PolyGeoPolyGeo

        54.1k1782246




        54.1k1782246






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f271220%2fdistinguishing-between-layers-and-tableview-using-arcpy%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Щит и меч (фильм) Содержание Названия серий | Сюжет |...

            is 'sed' thread safeWhat should someone know about using Python scripts in the shell?Nexenta bash script uses...

            Meter-Bus Содержание Параметры шины | Стандартизация |...