+ -
当前位置:首页 → 问答吧 → python报这样的异常是怎么回事 该怎么改正 请大家指教 多谢

python报这样的异常是怎么回事 该怎么改正 请大家指教 多谢

时间:2010-10-27

来源:互联网

Unhandled exception in thread started by <bound method Thread.__bootstrap of <Thread(Thread-14, stopped daemon -1349186672)>>
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/threading.py", line 504, in __bootstrap
  self.__bootstrap_inner()
  File "/usr/local/lib/python2.6/threading.py", line 545, in __bootstrap_inner
  (self.name, _format_exc()))
  File "/usr/local/lib/python2.6/traceback.py", line 236, in format_exc
  return ''.join(format_exception(etype, value, tb, limit))
  File "/usr/local/lib/python2.6/traceback.py", line 142, in format_exception
Segmentation fault

总是导致内存溢出 我用的是python2.6版本 os是linux 多谢

还有一个类似的:
Unhandled exception in thread started by 
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/threading.py", line 504, in __bootstrap
  self.__bootstrap_inner()
  File "/usr/local/lib/python2.6/threading.py", line 545, in __bootstrap_inner
  File "/usr/local/lib/python2.6/traceback.py", line 236, in format_exc
  return ''.join(format_exception(etype, value, tb, limit))
  File "/usr/local/lib/python2.6/traceback.py", line 142, in format_exception
  list = list + format_tb(tb, limit)
  File "/usr/local/lib/python2.6/traceback.py", line 76, in format_tb
  return format_list(extract_tb(tb, limit))
  File "/usr/local/lib/python2.6/traceback.py", line 101, in extract_tb
  line = linecache.getline(filename, lineno, f.f_globals)
  File "/usr/local/lib/python2.6/linecache.py", line 14, in getline
  lines = getlines(filename, module_globals)
  File "/usr/local/lib/python2.6/linecache.py", line 40, in getlines
  return updatecache(filename, module_globals)
Unhandled exception in thread started by <bound method Thread.__bootstrap of <Thread(Thread-17, stopped daemon -1379845232)>>Traceback (most recent call last):
  File "/usr/local/lib/python2.6/logging/handlers.py", line 71, in emit
MemoryError

好像都和traceback.py有关 请指教 多谢

作者: power0811   发布时间: 2010-10-27

贴你的代码,
traceback是打印你异常信息的

作者: amu9900   发布时间: 2010-10-27

我代码很多啊 可是这个异常不知道是哪个模块的代码报出来的 我打印异常信息的一般都是这样写的:
Python code

try:
    _l = urlex(webfile, '', '')
except:
     log.error("[urlparser_module]:handle err " + \
                '#' + one_url ) 



urlex是我自己的函数, webfile和one_url 都是字符串 还有 _l是个列表, log.error用的是标准库中logging模块, 只是自己封装了下

作者: power0811   发布时间: 2010-10-27

线程创建太多了?

作者: iambic   发布时间: 2010-10-27

exception MemoryError 
Raised when an operation runs out of memory but the situation may still be rescued (by deleting some objects). The associated value is a string indicating what kind of (internal) operation ran out of memory. Note that because of the underlying memory management architecture (C’s malloc() function), the interpreter may not always be able to completely recover from this situation; it nevertheless raises an exception so that a stack traceback can be printed, in case a run-away program was the cause.

拦MemoryError看看啥情况。

作者: I_NBFA   发布时间: 2010-10-27

还有其他方法么 这个是跑了6天的出现的情况 如果再捕获异常 可能又要等好几天了

作者: power0811   发布时间: 2010-10-27