[BangPypers] Module question

Abhinav Sarkar abhinav.sarkar at gmail.com
Tue Sep 2 07:21:47 CEST 2008

Heshan Suriyaarachchi wrote:
> Hi,
>     One of my scripts returns a module like below.
> <module 'annotationScript' from 
> '/home/heshan/repo/scripts/annotationScript.py'>
>      What I need to do is to extract the full path of the location of 
> the script as string. i.e. 
> '/home/heshan/repo/scripts/annotationScript.py' . Since I am 
> dynamically loading the script, it's name and full path may vary. Can 
> you suggest me a mechanism to extract the full path from the above 
> data structure.
> -- 
> Regards,
> Heshan Suriyaarachchi
> http://heshans.blogspot.com/
> ------------------------------------------------------------------------
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
__path__ attribute of module contains the path of file.
 >>> import lastfm
 >>> lastfm.__path__

I hope it helps.

Abhinav Sarkar
Fair Isaac India

Office: +91-8041371605

Web: http://claimid.com/abhin4v
Twitter: http://twitter.com/abhin4v
The world is a book, those who do not travel read only one page.

More information about the BangPypers mailing list