From be28187a5f5aede8be33d3efcdf9c67d82922e06 Mon Sep 17 00:00:00 2001 From: eficas <> Date: Thu, 6 Feb 2003 15:11:22 +0000 Subject: [PATCH] =?utf8?q?Antoine=20a=20ajout=C3=A9=20appels.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Utilites/__init__.py | 5 ++-- Utilites/appels.py | 55 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 Utilites/appels.py diff --git a/Utilites/__init__.py b/Utilites/__init__.py index 0eb857f9..19d51f8f 100644 --- a/Utilites/__init__.py +++ b/Utilites/__init__.py @@ -1,5 +1,5 @@ """ - $Id$ + $Id: __init__.py,v 1.2 2003/02/04 10:40:57 eficas Exp $ Le package UTILITES contient les fonctions permettant d'instrumenter un script : @@ -9,11 +9,12 @@ """ -__all__ = [ "ici" , "message" , "scrute" , "pause" ] +##__all__ = [ "ici" , "message" , "scrute" , "pause" , "appels" ] from pause import * from ici import * from scrute import * from message import * +from appels import * diff --git a/Utilites/appels.py b/Utilites/appels.py new file mode 100644 index 00000000..efc9a6d9 --- /dev/null +++ b/Utilites/appels.py @@ -0,0 +1,55 @@ +""" +Module appels +------------- + le module appels ... +""" + +import sys +sortie=sys.stderr +sortie.write( "import de "+__name__+" : $Id$" ) +sortie.write( "\n" ) + + +def APPELS() : + + """ + Fonction APPELS + --------------- + La fonction APPELS ... + .. + + + Usage : + from appels import APPELS + APPELS() + """ + + print "Passage dans APPELS" +### try : +### 1/0 +### except : +### import traceback +### trace=traceback.extract_stack() +### print trace + + import traceback + trace=traceback.extract_stack() + + trace.reverse() + + decalage="" + if len(trace)>2 : + for e in trace[2:-1] : + fic,numero,fonc,inst = e + print decalage+fic+":"+str(numero)+": "+fonc,inst + decalage += "\t" + + fic,numero,fonc,inst = trace[-1] + print decalage+fic+":"+str(numero)+": "+"__main__",inst + + + return + + +if __name__ == "__main__" : + APPELS() -- 2.39.2