python2.5 + py2exe 引起traceback出错,及解决办法


如果你的PYTHON 模块中使用了traceback 模块, 则使用py2exe 处理后的程序运行时出现:

File "traceback.pyc", line 236, in format_exc
  File "traceback.pyc", line 142, in format_exception
  File "traceback.pyc", line 76, in format_tb
  File "traceback.pyc", line 101, in extract_tb
TypeError: fake_getline() takes exactly 2 arguments (3 given)


解决办法:
   修改python25 安装目录下LIB\site-packages\py2exe\boot_comm.py 92行-94行改成

import linecache
def fake_getline(filename, lineno, module_globals=None):
    return ''


参考URL:
http://aspn.activestate.com/ASPN/Mail/Message/wxpython-users/3316337


说明:
使用PYTHON2.3 或者2.4不会出现此问题.