[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
>   
Hi,
__path__ attribute of module contains the path of file.
 >>> import lastfm
 >>> lastfm.__path__
['c:\\python25\\lib\\site-packages\\lastfm-0.1-py2.5.egg\\lastfm']

I hope it helps.
Cheers,

-- 
Abhinav Sarkar
Fair Isaac India

Mobile:+91-9731596137
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