Skip to content

Commit

Permalink
[column-] catch AttributeError viewing columns list as pyobj
Browse files Browse the repository at this point in the history
  • Loading branch information
midichef committed Dec 7, 2024
1 parent 37f0a0c commit b0203fc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion visidata/pyobj.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
Expand Down

0 comments on commit b0203fc

Please sign in to comment.