diff --git a/IPython/utils/dir2.py b/IPython/utils/dir2.py index 753285b..dd508b4 100644 --- a/IPython/utils/dir2.py +++ b/IPython/utils/dir2.py @@ -60,7 +60,11 @@ def dir2(obj): # Start building the attribute list via dir(), and then complete it # with a few extra special-purpose calls. - words = set(dir(obj)) + try: + words = set(dir(obj)) + except Exception: + # TypeError: dir(obj) does not return a list + words = set() if safe_hasattr(obj, '__class__'): #words.add('__class__')