[Tutor] A simple Question...
Kent Johnson
kent37 at tds.net
Tue Oct 2 04:06:41 CEST 2007
Suzanne Peel wrote:
>
> Hi,
>
> I have a very simple question that I cannot find the answer to ... if I
> knew the correct question to ask it would be simple.
>
> I am trying to find the name of the file I am currently running (please
> don't laugh at me I know it's simple but I cannot figure it out).
__file__ is the name of the current module.
>
> I want to know where my errors are occurring so if I print out the name
> of the file (or script) when it starts that should help me
What kind of errors are you getting? If they are exceptions you should
be able to get a traceback easily with traceback.print_exc(). You can
also print out a full stack trace at any time with traceback.print_stack().
Kent
More information about the Tutor
mailing list