开发者

Trace/BPT trap when running feedparser inside a Thread object

开发者_如何学JAVAI 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


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()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜