I meant a module<div><br></div><div>src.directory contains </div><div>__init__.py<br>neal.py</div><div>becker.py</div><div><br></div><div>from src.directory import neal</div><div><br></div><div><br><div class="gmail_quote">
On Mon, Jun 18, 2012 at 9:44 AM, Dave Angel <span dir="ltr"><<a href="mailto:d@davea.name" target="_blank">d@davea.name</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 06/18/2012 09:19 AM, Neal Becker wrote:<br>
> Am I correct that a module could never come from a file path with a '.' in the<br>
> name?<br>
><br>
<br>
No.<br>
<br>
Simple example: Create a directory called src.directory<br>
In that directory, create two files<br>
<br>
::neal.py::<br>
import becker<br>
print becker.__file__<br>
print becker.hello()<br>
<br>
<br>
::becker.py::<br>
def hello():<br>
print "Inside hello"<br>
return "returning"<br>
<br>
<br>
Then run neal.py, from that directory;<br>
<br>
<br>
davea@think:~/temppython/src.directory$ python neal.py<br>
/mnt/data/davea/temppython/src.directory/becker.pyc<br>
Inside hello<br>
returning<br>
davea@think:~/temppython/src.directory$<br>
<br>
Observe the results of printing __file__<br>
<br>
Other approaches include putting a directory path containing a period<br>
into sys.path<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
--<br>
<br>
DaveA<br>
<br>
</font></span></blockquote></div><br></div>