From b0203fcf4c42e0a97f475fc19e7018abdbc04a46 Mon Sep 17 00:00:00 2001 From: midichef <67946319+midichef@users.noreply.github.com> Date: Sat, 7 Dec 2024 12:12:24 -0800 Subject: [PATCH] [column-] catch AttributeError viewing columns list as pyobj --- visidata/pyobj.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/visidata/pyobj.py b/visidata/pyobj.py index 9286e7ae8..fe6dcbbfd 100644 --- a/visidata/pyobj.py +++ b/visidata/pyobj.py @@ -49,7 +49,14 @@ def view(vd, obj): def getPublicAttrs(obj): 'Return all public attributes (not methods or `_`-prefixed) on object.' - return [k for k in dir(obj) if not k.startswith('_') and not callable(getattr(obj, k))] + attrs = [] + for k in dir(obj): + try: + if not k.startswith('_') and not callable(getattr(obj, k)): + attrs.append(k) + except AttributeError: #attributes like formatted_help can raise AttributeError #2631 + pass + return attrs def PyobjColumns(obj): 'Return columns for each public attribute on an object.'