# AttributeError: 'List\[object\]' object has no attribute 'id' trying to filter elements

**URL:** <https://forum.dynamobim.com/t/attributeerror-list-object-object-has-no-attribute-id-trying-to-filter-elements/73660>\
**Category:** Revit\
**Tags:** dynamo\
**Created:** [February 24, 2022, 8:42am UTC](https://forum.dynamobim.com/t/attributeerror-list-object-object-has-no-attribute-id-trying-to-filter-elements/73660 "2022-02-24T08:42:26Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivarandersenjobb](https://avatars.discourse-cdn.com/v4/letter/i/9de0a6/32.png) [@Ivarandersenjobb](https://forum.dynamobim.com/u/Ivarandersenjobb)\
**Post date:** [February 24, 2022, 8:42am UTC](https://forum.dynamobim.com/t/attributeerror-list-object-object-has-no-attribute-id-trying-to-filter-elements/73660/1 "2022-02-24T08:42:26Z")

</div>

Hi peeps

Trying to filter out only objects that are not curently owned by others in a shared project. But i get this error. Im vaguely familiar with coding. This is not my code, i got it from a colleague. Thanks to whoever made it.

Any tips to what the problem may be here?

import clr

clr.AddReference(“RevitServices”)

import RevitServices

from RevitServices.Persistence import DocumentManager

from RevitServices.Transactions import TransactionManager

clr.AddReference(“RevitAPI”)

import Autodesk

from Autodesk.Revit.DB import \*

clr.AddReference(‘System.Core’)

from System.Collections.Generic import \*

doc = DocumentManager.Instance.CurrentDBDocument

uiapp = DocumentManager.Instance.CurrentUIApplication

app = uiapp.Application

def ToList(x):

```
if isinstance(x,list):

    return UnwrapElement(x)

else:

    return [UnwrapElement(x)]

```

elem = ToList(IN[0])

iDs = [el.Id for el in elem]

Ids = ListElementId

try: checkedout\_el = WorksharingUtils.CheckoutElements(doc,Ids)

except Exception,er: checkedout\_el = str(er)

OUT = checkedout\_el

 ![image001](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/b/cbdbfaeba6c3098367bb0f7743b954545cf6f934.png)

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [February 24, 2022, 9:08am UTC](https://forum.dynamobim.com/t/attributeerror-list-object-object-has-no-attribute-id-trying-to-filter-elements/73660/2 "2022-02-24T09:08:22Z")

</div>

```auto
import System
import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

def ToList(x):
	if isinstance(x,list):
		return UnwrapElement(x)
	else:
		return [UnwrapElement(x)]

elem = ToList(IN[0])
iDs = [el.Id for el in elem]
Ids = ListElementId

try: checkedout_el = WorksharingUtils.CheckoutElements(doc,Ids)
except Exception,er: checkedout_el = str(er)

OUT = checkedout_el

```

![2022-02-24_10h07_11](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/8/58f8fa60d61c2c09a9eae8db163b0bcefd543ebb.png)  
I changed the libraries! i took the framing from:  
[https://primer.dynamobim.org/10\_Custom-Nodes/10-6\_Python-Templates.html](https://primer.dynamobim.org/10_Custom-Nodes/10-6_Python-Templates.html)  
I did not find the error. ListElementId is not difined…  
…hmmm

---

<div class="post-metadata">

**Author:** ![Ivarandersenjobb](https://avatars.discourse-cdn.com/v4/letter/i/9de0a6/32.png) [@Ivarandersenjobb](https://forum.dynamobim.com/u/Ivarandersenjobb)\
**Post date:** [February 24, 2022, 9:19am UTC](https://forum.dynamobim.com/t/attributeerror-list-object-object-has-no-attribute-id-trying-to-filter-elements/73660/3 "2022-02-24T09:19:08Z")

</div>

Hi, thanks for replying.

Are you saying you got it to work by doing that? Or that you did not find what is causing the error?

My best guess was that a elemt was missing some info, but it did not work with any element. So my guess is there something maybe missing in the code.

Any help appreciated, getting this working would really help me out.

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [February 24, 2022, 9:25am UTC](https://forum.dynamobim.com/t/attributeerror-list-object-object-has-no-attribute-id-trying-to-filter-elements/73660/4 "2022-02-24T09:25:34Z")

</div>

No, i was not able to solve it. there is variable not defined.

---

<div class="post-metadata">

**Author:** ![Ivarandersenjobb](https://avatars.discourse-cdn.com/v4/letter/i/9de0a6/32.png) [@Ivarandersenjobb](https://forum.dynamobim.com/u/Ivarandersenjobb)\
**Post date:** [February 24, 2022, 9:32am UTC](https://forum.dynamobim.com/t/attributeerror-list-object-object-has-no-attribute-id-trying-to-filter-elements/73660/5 "2022-02-24T09:32:28Z")

</div>

My thoughts as well. Hope there is a big brain in here up for the challenge 🙂

Thanks for having look at it 👍

---

<div class="post-metadata">

**Author:** ![Elie.Trad](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/elie.trad/32/110373_2.png) [@Elie.Trad](https://forum.dynamobim.com/u/Elie.Trad)\
**Post date:** [February 24, 2022, 9:51am UTC](https://forum.dynamobim.com/t/attributeerror-list-object-object-has-no-attribute-id-trying-to-filter-elements/73660/7 "2022-02-24T09:51:56Z")

</div>

@Ivarandersenjobb try it like that:

```auto
Ids = List[ElementId]()
for el in elem:
	Ids.Add(el.Id)

```

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [February 24, 2022, 10:48am UTC](https://forum.dynamobim.com/t/attributeerror-list-object-object-has-no-attribute-id-trying-to-filter-elements/73660/8 "2022-02-24T10:48:13Z")

</div>

```auto
import System
import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

def ToList(x):
	if isinstance(x,list):
		return UnwrapElement(x)
	else:
		return [UnwrapElement(x)]

elem = ToList(IN[0])
iDs = [el.Id for el in elem]

Ids = List[ElementId]()
for el in elem:
	Ids.Add(el.Id)

try: checkedout_el = WorksharingUtils.CheckoutElements(doc,Ids)
except Exception,er: checkedout_el = str(er)

OUT = checkedout_el

```

 ![2022-02-24_11h47_38](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/e/3eaa4d8d7781110db4e4b03797a276f06fe8f711.png)  
It runs!

---

<div class="post-metadata">

**Author:** ![Ivarandersenjobb](https://avatars.discourse-cdn.com/v4/letter/i/9de0a6/32.png) [@Ivarandersenjobb](https://forum.dynamobim.com/u/Ivarandersenjobb)\
**Post date:** [February 24, 2022, 11:11am UTC](https://forum.dynamobim.com/t/attributeerror-list-object-object-has-no-attribute-id-trying-to-filter-elements/73660/9 "2022-02-24T11:11:35Z")

</div>

Thank you for the effort!  
I tried you exact code. Didn’t run here.

May i be missing something in my set-up?

The instalation is just 2 months old. I have just run my usual 3-4 scripts. Not changed anything. Only have 4-5 packages installed.

Revit 2021.1.4  
Dynamo core 2.5.1.8786  
Dynamo Revit 2.6.1.8850

The file im working on is started in Revit 2018.  
Its a BIM360 project.

May i be missing a Python dependancy/package more on a “system-level”?

 ![image001 (1)](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/b/0b3e14557f01f9d39d5a1496658f060721836c5d.png)

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [February 24, 2022, 11:36am UTC](https://forum.dynamobim.com/t/attributeerror-list-object-object-has-no-attribute-id-trying-to-filter-elements/73660/10 "2022-02-24T11:36:08Z")

</div>

Whats your imput?  
it should be Elements!

my run was with Furniture family instances

---

<div class="post-metadata">

**Author:** ![Elie.Trad](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/elie.trad/32/110373_2.png) [@Elie.Trad](https://forum.dynamobim.com/u/Elie.Trad)\
**Post date:** [February 24, 2022, 11:41am UTC](https://forum.dynamobim.com/t/attributeerror-list-object-object-has-no-attribute-id-trying-to-filter-elements/73660/11 "2022-02-24T11:41:30Z")

</div>

@Ivarandersenjobb remove line 35 from your code: `iDs = [el.Id for el in elem]`

---

<div class="post-metadata">

**Author:** ![Ivarandersenjobb](https://avatars.discourse-cdn.com/v4/letter/i/9de0a6/32.png) [@Ivarandersenjobb](https://forum.dynamobim.com/u/Ivarandersenjobb)\
**Post date:** [February 24, 2022, 12:10pm UTC](https://forum.dynamobim.com/t/attributeerror-list-object-object-has-no-attribute-id-trying-to-filter-elements/73660/12 "2022-02-24T12:10:02Z")

</div>

Worked, kinda. The error moved to line 39 😃

Any further ideas?

 ![image001 (2)](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/d/2d2ec20baa0b4426757e8430e7e00987af37ff6e.png)

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [February 24, 2022, 12:15pm UTC](https://forum.dynamobim.com/t/attributeerror-list-object-object-has-no-attribute-id-trying-to-filter-elements/73660/13 "2022-02-24T12:15:18Z")

</div>

whats your imput? values or elements?

Object has no Id. Sounds like the imput is not correct!

```auto
import System
import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

def ToList(x):
	if isinstance(x,list):
		return UnwrapElement(x)
	else:
		return [UnwrapElement(x)]

elem = ToList(IN[0])

Ids = List[ElementId]()
for el in elem:
	Ids.Add(el.Id)

try: checkedout_el = WorksharingUtils.CheckoutElements(doc,Ids)
except Exception,er: checkedout_el = str(er)

OUT = checkedout_el

```

---

<div class="post-metadata">

**Author:** ![gilbertcane](https://avatars.discourse-cdn.com/v4/letter/g/b5ac83/32.png) [@gilbertcane](https://forum.dynamobim.com/u/gilbertcane)\
**Post date:** [October 18, 2022, 5:45am UTC](https://forum.dynamobim.com/t/attributeerror-list-object-object-has-no-attribute-id-trying-to-filter-elements/73660/14 "2022-10-18T05:45:24Z")

</div>

Python lists cannot be divided into separate lists based on characters that appear in the values of a list. This is unlike strings which values can be separated into a list. The AttributeError is an exception thrown when an object does not have the attribute you tried to access. The ‘list’ object has no attribute ‘split’ and you’re trying to call python split() function on the whole list of lines, and you can’t split a list of strings, only a string. So, you need to split each line, not the whole thing.

To solve the above problem, you need to iterate over the strings in the list to get individual strings; then, you can call the split() function.
