[Baypiggies] Can you get the filename which is being execfile()'d from within the file being execfiled?

Douglas Sims doug at apley.com
Thu Dec 13 02:29:29 CET 2007


Interesting question.

I think you can get that with:


sys._getframe().f_code.co_filename


Douglas Sims
Doug at Apley.com


On Dec 12, 2007, at 6:10 PM, William Deegan wrote:

> Greetings,
>
>
> If I execfile('abc.py')
>
> And abc.py calls function tellme().
> Is there a global or a way to pass to tellme() the filename being  
> execfile()'d?
>
> Let me know if this is not clear.
>
> Thanks,
> Bill
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> http://mail.python.org/mailman/listinfo/baypiggies

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/baypiggies/attachments/20071212/0982ea98/attachment.htm 


More information about the Baypiggies mailing list