Python shell stuck on exit

Python fails if I import two libraries in a specific order. I am using python scitools and fenicstools libraries .

The following will work in the python shell:

import fenicstools
import scitools
exit()

This will not exit, but freezes (cancels the import):

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 now I completely lose. How do I even start debugging such a problem?

Background: I use sumatra to track my numerical models. It collects and logs dependency versions of my project. Thus, I cannot control the order in which he is trying to do this. Result: he is stuck.

Edit: @ErlVolton, pdb. 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

... pdb .

+4
1

pdb , fenicstools __init__.py

https://docs.python.org/2/library/pdb.html

:

$ pdb test.py
> /home/cleekley/test/test.py(1)<module>()
-> import sys
(Pdb) s
> /home/cleekley/test/test.py(2)<module>()
-> import time
(Pdb) s
> /home/cleekley/test/test.py(4)<module>()
-> while True:
(Pdb) s
> /home/cleekley/test/test.py(5)<module>()
-> time.sleep(1)
(Pdb) s
> /home/cleekley/test/test.py(4)<module>()
-> while True:
(Pdb) quit
0

All Articles