Cannot debug generated scripts using ipython in Python 3.6
I used to be able to run commands like bin/python `which ipython` --pdb -- bin/bob ...
to debug my scripts.
Now after I have switched to Python 3.6 this fails with the following error:
AttributeError Traceback (most recent call last)
/remote/idiap.svm/user.active/amohammadi/git/deep/bin/bob in <module>()
64 ]
65 if sys.version_info[:2] >= (3, 6): #see: http://bugs.python.org/issue30167
---> 66 _hack = str(sys.modules['__main__'].__loader__.__module__)
67 sys.modules['__main__'].__loader__.__module__ += '_'
68 import site #initializes site properly
AttributeError: 'NoneType' object has no attribute '__module__'
> /remote/idiap.svm/user.active/amohammadi/git/deep/bin/bob(66)<module>()
64 ]
65 if sys.version_info[:2] >= (3, 6): #see: http://bugs.python.org/issue30167
---> 66 _hack = str(sys.modules['__main__'].__loader__.__module__)
67 sys.modules['__main__'].__loader__.__module__ += '_'
68 import site #initializes site properly
However when I run just bin/bob ...
it works.