Trace / BPT Trap with Threading Python Module

The following code dies with Trace/BPT trap

:

from tvdb_api import Tvdb
from threading import Thread

class GrabStuff(Thread):
    def run(self):
        t = Tvdb()

def main():
    threads = [GrabStuff() for x in range(1)]
    [x.start() for x in threads]
    [x.join() for x in threads]

if __name__ == '__main__':
    main()

      

The error is due to Tvdb()

, but I have no idea why.

I ran the code with python -m pdb thescript.py

and walked through the code and it dies after the following lines:

> .../threading.py(468)start()
-> _active_limbo_lock.acquire()
(Pdb) 
> .../threading.py(469)start()
-> _limbo[self] = self
(Pdb) 
> .../threading.py(470)start()
-> _active_limbo_lock.release()
(Pdb) 
> .../threading.py(471)start()
-> _start_new_thread(self.__bootstrap, ())
(Pdb) 
> .../threading.py(472)start()
-> self.__started.wait()
(Pdb) Trace/BPT trap

      

(I replaced the full path to threading.py with ...

)

The same thing happens with 2.6.1

and 2.5.4

. The machine is running OS X 10.6.1 Snow Leopard. The code tvdb_api

can be found at github.com/dbr/tvdb_api

+1


source to share


1 answer


Bad things can happen the first time modules enter a thread in OS X 10.6. See, for example, this question . As a workaround, try browsing Tvdb and adding your complete import chain to the main module.



+3


source







All Articles