diff --git a/IPython/utils/dir2.py b/IPython/utils/dir2.py index 753285b..c2f268c 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: + # TypeError: dir(obj) does not return a list + words = set() if safe_hasattr(obj, '__class__'): #words.add('__class__')