On 15/01/2010 18:26, Alex Hall wrote:
What is the syntax to write the traceback to a text file? I have the file object and I can open and close the file, I just need the command, like "f.write(StackTrace())" or whatever the command is. I will try the alt-space idea as well.
Just to answer this question on its own for the moment: the following code is the kind of thing you can use to trap an error and write the traceback to a file. (You could also use the stdlib logging module): <code> import traceback try: 1 / 0 # or something more useful except: with open ("error.log", "a") as f: traceback.print_exc (file=f) # or f.write (traceback.format_exc ()) </code> TJG _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32