import doesn't work as i want

Olivier Noblanc ATOUSOFT tech at gpao.cc
Mon Jan 31 11:29:47 EST 2005


how to move in function ?

"Fredrik Lundh" <fredrik at pythonware.com> a écrit dans le message de news: 
mailman.1643.1107187553.22381.python-list at python.org...
> Olivier Noblanc wrote:
>
>> In the botom of this post you will see my source code.
>>
>> The problem is when i launch main.py that doesn't make anything why ?
>
> the "if __name__" statement checks the name of the module.  if you run
> Python file as a script, by passing a filename to the python interpreter, 
> the
> __name__ variable is set to  "__main__".  if you import a file as a 
> module,
> the __name__ is the name of the module, not "__main__".
>
> if you want main.py to do something, move that code to main.py (or move
> it into a function, and call it from main.py)
>
> </F>
>
> 





More information about the Python-list mailing list