Work with TextNode Revit 2019

Hello every1)
I have a script that uses selected elements in the work (a little more convenient than the standard Select Model Elements, No need to press “Select” and then choose)
In 2022 Revit works great, but in 2019 it gave the error “Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.”
I thought that the syntax had changed and decided to try with a standard node, but it also gave me “Null”. How to work with text (TextNode) in 2019 Revit? More precisely, how to select it?) The rest of the script should work if I can get the text as an element

import clr
clr.AddReference('RevitServices')
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
import RevitServices
from RevitServices.Persistence import DocumentManager
from Autodesk.Revit.ApplicationServices import Application

reset = IN[0]

doc = DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
ids = uidoc.Selection.GetElementIds()

idd = [str(i) for i in ids]

if isinstance(idd, list) == True:
 elems = [doc.GetElement(ElementId(int(i))) for i in idd]
else:
 elems = doc.GetElement(ElementId(int(idd)))

OUT = elems

@Storm ,

i can`t test it … but look on your syntex and libraries

import sys
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

reset = IN[0]

doc = DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
ids = uidoc.Selection.GetElementIds()

idd = [str(i) for i in ids]

if isinstance(idd, list) == True:
    elems = [doc.GetElement(ElementId(int(i))) for i in idd]
else:
    elems = doc.GetElement(ElementId(int(idd)))

OUT = elems

Hello @Draxl_Andreas ,
Unfortunately i get same error
Just Ctrl+C Ctrl+V your code

Your selection code seems a little more complicated than necessary. Here are the two lines of code I use to acquire the current Revit selection.

sel = uidoc.Selection.GetElementIds()
sel = [doc.GetElement(x) for x in sel]