try:
M = poplib.POP3('mail.server.com')
except:
print "Oops! Error"
try:
foo
except Exception, e:
print(e)
M = poplib.POP3('mail.server.com', 110, 30)
Error: __init__() takes at most 3 arguments (4 given)
$goo = fopen("http://www.google.com", "rb") or die (fwrite($fh, $stringData1));
prnt = time.strftime("%a %b %d %H:%M:%S %Y")+"- 2/2 (Site Status:?) POP Error:"+e
Traceback (most recent call last):
File "mailtest.py", line 30, in <module>
prnt = time.strftime("%a %b %d %H:%M:%S %Y")+"- 2/2 (Site Status:?) POP Error:"+e
TypeError: cannot concatenate 'str' and 'exceptions.TypeError' objects
I can do something like script.py > output.txt, but that only catches the print. I'm more focused on writing any possible errors to a file instead of the print line. Example:
I need to ifcheck if that happens and write all of that to a different file. How would I do that?