<div dir="ltr">Hi 
Abhinav,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I managed to overcome the problem.<br>Thanx :)<br><br><div class="gmail_quote">On Tue, Sep 2, 2008 at 11:03 AM, abhinav sarkar <span dir="ltr">&lt;<a href="mailto:abhinav.sarkar@gmail.com">abhinav.sarkar@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div dir="ltr"><div><div></div><div class="Wj3C7c"><br><br><div class="gmail_quote">On Tue, Sep 2, 2008 at 10:51 AM, Abhinav Sarkar <span dir="ltr">&lt;<a href="mailto:abhinav.sarkar@gmail.com" target="_blank">abhinav.sarkar@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Heshan Suriyaarachchi wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div>
Hi,<br>
 &nbsp; &nbsp;One of my scripts returns a module like below.<br>
&lt;module &#39;annotationScript&#39; from &#39;/home/heshan/repo/scripts/annotationScript.py&#39;&gt;<br>
 &nbsp; &nbsp; What I need to do is to extract the full path of the location of the script as string. i.e. &#39;/home/heshan/repo/scripts/annotationScript.py&#39; . Since I am dynamically loading the script, it&#39;s name and full path may vary. Can you suggest me a mechanism to extract the full path from the above data structure.<br>


-- <br>
Regards,<br>
Heshan Suriyaarachchi<br>
<br>
<a href="http://heshans.blogspot.com/" target="_blank">http://heshans.blogspot.com/</a><br></div></div>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<br>
BangPypers mailing list<br>
<a href="mailto:BangPypers@python.org" target="_blank">BangPypers@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/bangpypers" target="_blank">http://mail.python.org/mailman/listinfo/bangpypers</a><br>
 &nbsp;<br>
</blockquote>
Hi,<br>
__path__ attribute of module contains the path of file.<br>
&gt;&gt;&gt; import lastfm<br>
&gt;&gt;&gt; lastfm.__path__<br>
[&#39;c:\\python25\\lib\\site-packages\\lastfm-0.1-py2.5.egg\\lastfm&#39;]<br>
<br>
I hope it helps.<br>
Cheers,<br>
<br>
-- <br>
Abhinav Sarkar<br>
Fair Isaac India<br>
<br>
Mobile:+91-9731596137<br>
Office: +91-8041371605<br>
<br>
Web: <a href="http://claimid.com/abhin4v" target="_blank">http://claimid.com/abhin4v</a><br>
Twitter: <a href="http://twitter.com/abhin4v" target="_blank">http://twitter.com/abhin4v</a><br>
---------<br>
The world is a book, those who do not travel read only one page.<br>
<br>
</blockquote></div><br></div></div>Hi,<br>I was mistaken in last reply. __path__ attribute exists only for packages. You should use __file__ attribute. It works for packages and modules too.<br><br>&gt;&gt;&gt; import lastfm<br>
&gt;&gt;&gt; from lastfm import api<br clear="all">
&gt;&gt;&gt; api.__file__<br>&#39;c:\\python25\\lib\\site-packages\\lastfm-0.1-py2.5.egg\\lastfm\\api.pyc&#39;<br>&gt;&gt;&gt; lastfm.__file__<br>&#39;c:\\python25\\lib\\site-packages\\lastfm-0.1-py2.5.egg\\lastfm\\__init__.pyc&#39;<div class="Ih2E3d">
<br>
<br><br>Cheers<br>-- <br>Abhinav Sarkar<br>Fair Isaac India<br><br>Mobile:+91-9731596137<br>Office: +91-8041371605<br><br>Web: <a href="http://claimid.com/abhin4v" target="_blank">http://claimid.com/abhin4v</a><br>Twitter: <a href="http://twitter.com/abhin4v" target="_blank">http://twitter.com/abhin4v</a><br>

---------<br>The world is a book, those who do not travel read only one page.<br>
</div></div>
<br>_______________________________________________<br>
BangPypers mailing list<br>
<a href="mailto:BangPypers@python.org">BangPypers@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/bangpypers" target="_blank">http://mail.python.org/mailman/listinfo/bangpypers</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Regards,<br>Heshan Suriyaarachchi<br><br><a href="http://heshans.blogspot.com/">http://heshans.blogspot.com/</a><br>
</div>