Anselm Kruis added the comment: Hi,
I was faced with a very similar problem also caused by an invalid file descriptor. My solution is to set an invalid parameter handler, that does nothing. This effectively disables Dr. Watson. Perhaps this is a suitable solution for other users too. And it does not require a patch. def set_invalid_parameter_handler(flag): """ Set the MSVCRT invalid parameter handler. If flag is True, this function sets an invalid parameter handler, that does nothing. This effectively disables Dr. Watson. If flag is an integer number, it must be the address of an invalid parameter handler function. If flag is None, this function removes the invalid parameter handler. This effectively enables Dr. Watson. The return value is the address of the current handler or None, if no handler is installed. Example:: old = set_invalid_parameter_handler(True) try: do_something_nasty finally: set_invalid_parameter_handler(old) """ try: # get the msvcrt library import ctypes.util libc = ctypes.util.find_msvcrt() if not libc: # probably not windows return None libc = getattr(ctypes.cdll, libc) siph = libc._set_invalid_parameter_handler siph.restype = ctypes.c_void_p siph.argtypes = [ ctypes.c_void_p ] # now we need a suitable handler. # The handler must simply return without performing any actions. # Of course there is none. # But if we look at the calling convention (cdecl), and # at the fact, that we don't need the argument values # we find, that we can call any function, as long as the function # does not harm. A suitable function is "int abs(abs)". null_handler = libc.abs except Exception: # probably not the correct windows version return None if flag is True: flag = null_handler return siph(flag) ---------- nosy: +anselm.kruis _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5773> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com