<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
Still I appreciate if someone could explain me why.<br>
<div><div></div><div class="h5"></div></div></blockquote><div><br></div><div>We can't without seeing the code. There shouldn't be any difference, so if there is then its because your code is doing something to cause it-- break it down to a runnable example and we may be able to tell you why, giving us real code and real errors / output. When you distill it into a pseudocode explanation of what you're doing and ask why it doesn't work, quite often what you end up doing is unintentionally leaving out the cause.</div>

<div><br></div><div>E.g., I made two files;</div><div><br></div><div>main.py</div><div><div>    my_name = __name__</div><div>    print my_name </div><div>    print len(dir())</div><div>    from other import y as z</div><div>

    print __name__</div><div>    print len(dir())</div><div>    print my_name</div><div>other.py:</div><div>    y = True</div><div><br></div></div><div>And the output is -- no matter if there's a pyc or not -- always:</div>

<div><div>    __main__</div><div>    5</div><div>    __main__</div><div>    6</div><div>    __main__</div><div><br></div><div>There's nothing in default/standard Python which is causing this behavior-- Python doesn't run code differently based on if there's a pyc or not or if its generating a pyc or not, not by itself. You have to be doing something which is goofying up the interpreter somewhere. Not sure what, but it has to be in that 'x' you're importing from :)</div>

<div><br></div></div><div>--S</div></div>