[Tutor] A simple Question...
Kent Johnson
kent37 at tds.net
Tue Oct 2 13:30:55 CEST 2007
Suzanne Peel wrote:
>
> Thankyou for your help,
>
> However both suggestions will only give me that name of the 1st file
> executed eg when I use *execfile('EA_Owner.py')* the name returned
> when the __file__ or sys.argv[0] is executed always EA_Owner.py .
>
> The Traceback feature is an excellent resource however the errors I am
> trying to follow are not python errors but come from the data I am
> manipulating - I cannot remember off-the-top-of-my-head what order each
> file is called so I resort to opening the main file to figure it out -
> it would be nice if I could write out the name whenever the script runs
> the I just look for the name... I do realise I could hardcode the names
> I was just looking for a more elegant solution that I can put in all my
> scripts identifying which one is executing.
I am having a hard time understanding what you are doing, what kind of
errors you are getting, and what information you want to print out. Can
you show some of your code, or perhaps a simple example of what you are
doing, together with some indication of what you want to print out?
> The trace-back feature provides this - can I force an error of sorts
> that will not suspend programming but will report the file/module/script
> that it is running ??? (Probably a bit dramatic but I am at a loss..)
traceback.print_stack() prints the stack trace to the current point of
execution. No forced error or drama needed :-)
Kent
More information about the Tutor
mailing list