This repository has been archived on 2021-03-01. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
kaneton/test/packages/ktp/trace.py
Mercier Pierre-Olivier fee4dd4e6d Initial snapshot
2013-02-11 22:04:30 +01:00

46 lines
1,007 B
Python

#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/KANETON-TEST-SYSTEM/server/ktp/trace.py
#
# created julien quintard [mon oct 25 20:46:33 2010]
# updated julien quintard [tue oct 26 15:42:17 2010]
#
#
# ---------- packages ---------------------------------------------------------
#
import traceback
import miscellaneous
#
# ---------- functions --------------------------------------------------------
#
#
# this function generates a stack trace.
#
def Generate():
temporary = None
trace = None
# create a temporary file.
temporary = miscellaneous.Temporary(miscellaneous.OptionFile)
# put the trace in the temporary file.
traceback.print_exc(None, file(temporary, 'w'))
# read the file.
trace = miscellaneous.Pull(temporary)
# remove the temporary file.
miscellaneous.Remove(temporary)
# return the trace.
return trace