views:

22

answers:

1

Hello,

I am trying to run a Thread to parse a list of links using the universal feed parser, but when I start the thread I get a Trace/BPT trap.

Here's the code I am using:

class parseRssFiles(Thread):
   def __init__ (self,rssLinks):
      Thread.__init__(self)
      self.rssLinks = rssLinks
   def run(self):
      self.rssContents = [ feedparser.parse(link) for link in rssLinks]

Is there any other way to do this?

Link to the report generated by Mac OS X 10.6.2: http://simaom.com/trace.txt

Thanks

+1  A: 

Without a working test case, it is hard to know for sure but I suspect you are running into the problem documented in Python tracker issue 7144, namely, trying to initialize the CoreFoundation framework on other than the main thread. That problem is fixed in Python 2.6.5 which you could install from python.org or MacPorts. An untested workaround for the Apple-supplied Python 2.6.1 in 10.6 may be to execute something innocuous in the main thread that will cause CoreFoundation to be initialized before starting any secondary threads. Something like this in the main thread might do it:

import locale
locale.getdefautlocale()
Ned Deily
Yes, that was it. Thanks.
simao