Sunday 15 April 2012

Python - Writing any/all potential errors to a file without defining what part might go wrong? -


I'm sure all errors are saved in a text file, but there is no way to get it

I have kept an eye on my side, but I can not find anything according to my needs: /

I am sure an easy way to do this should be there. Thanks in advance - Hyflex

  import system sys.stderr = open ("some_log.txt", "Wb")   

I think at least ...

  & gt; & Gt; & Gt; Import Stringo & gt; & Gt; & Gt; Import systems and gt; & Gt; & Gt; S = StringIO.StringIO ()> & gt; & Gt; & Gt; Sys.stderr = s & gt; & Gt; & Gt; 5 = 7> and gt; & Gt; 5/0 & gt; & Gt; & Gt; S. Sec (0) >> gt; & Gt; S.read () 'file' & lt; Stdin & gt; ", Line 1 \ n Syntax error: \" can assign to tacticback \ n (last called): \ nThe file "& lt; stdin & gt;", in line 1, in & lt; Module & gt; \ NZeroDivisionError: integer divisions or modules from zero \ n '   

No comments:

Post a Comment