Python doesn't exit if I have imported two libraries in a certain order. I'm using the python libraries scitools and fenicstools.
In the python shell, the following will work:
import fenicstools
import scitools
exit()
This won't exit but hang (reversed the imports):
import scitools # ok
import fenicstools # ok
exit() # gets me stuck, I can still exit with Ctrl+C
I can reproduce this on two Ubuntu 14.04 machines and am now at a complete loss. How do I even start debugging such an issue?
Background: I'm using sumatra to keep track of my numerical simulations. It gathers and logs the versions of the dependencies of my project. I thus have no control over the order in which it tries to do so. Result: It gets stuck.
Edit:
Following @ErlVolton's suggestion, I tried pdb. Put the two imports in their problematic order in a file called test.py
.
$ pdb test.py
> /home/gallomania/test.py(1)<module>()
-> import scitools
(Pdb) n
> /home/gallomania/test.py(2)<module>()
-> import fenicstools
(Pdb) n
--Return--
> /home/gallomania/test.py(2)<module>()->None
-> import fenicstools
(Pdb) exit
... This makes pdb not exit.