# Get Views - Remove nulls in python

**URL:** <https://forum.dynamobim.com/t/get-views-remove-nulls-in-python/81531>\
**Category:** Revit\
**Tags:** python\
**Created:** [September 27, 2022, 6:20pm UTC](https://forum.dynamobim.com/t/get-views-remove-nulls-in-python/81531 "2022-09-27T18:20:26Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [September 28, 2022, 10:46am UTC](https://forum.dynamobim.com/t/get-views-remove-nulls-in-python/81531/6 "2022-09-28T10:46:15Z")

</div>

the **OUT** Dynamo Wrapper _is capricious_ with certain objects

here a solution

```auto
import sys
import clr
import System
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

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

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
		
ueWrapper = next((m for m in clr.GetClrType(Revit.Elements.ElementWrapper)\
				.GetMethods() if m.Name == "Wrap"), None)
				
if ueWrapper is None:
	raise Exception("Error Method", "method 'Revit.Elements.ElementWrapper.Wrap' not found") 

views = FilteredElementCollector(doc).OfClass(View).ToElements()

outlist = []

for i in views:
	iswrapable = Revit.Elements.ElementWrapper.Wrap(i, True)
	if iswrapable is None :
		outlist.append(ueWrapper.Invoke(None, (i, True) ))
	else:
		outlist.append(i)

OUT = outlist

```

---

_[View the full topic](https://forum.dynamobim.com/t/get-views-remove-nulls-in-python/81531)._
