I have a weird error when try to redirect a exception to STDERR.
I have a script that is use to load several "plugins", working as main entry program. The plugins do stuff like connect to databases, parsing text data, connect to web services, etc...
Is like this:
try:
Run plugins here...
#All was ok!
print "Ok!"
sys.exit(0)
except Exception,e:
sys.stderr.writelines([unicode(e),u'\n',u'\n'])
traceback.print_exc(file=sys.stderr)
sys.exit(-1)
This is executed in the command-line, and sometimes I get the error:
TypeError: writelines() argument must be a sequence of strings
I have no clue how in this earth a Exception is not returning as a string here.