python packages and __name__ query.

krishnakant Mane researchbase at gmail.com
Sat Jan 20 20:12:28 CET 2007


hello all,
I had previously mentioned my doubt and confusion about having a
main() to be an entry point in my python based software.
I am still having a particular doubt.
I use cx freze for creating a python executable.  my software is
essentially a package containing a few modules and one file where I
created the main() function.
if needed and suggested by experts I may as well put it in my
__init__.py file of the package.
coming back to the point.  where do I put the following code
if __name__ == "__main__":
   main()

I have 5 modules in my package each doing a specific task.
and a file that contains the main() function.  the 5 modules and the
exec.py file all are in the same package.  if it is a wrong practice
please correct me.
so plese clear my doubt given the above situation.
Krishnakant.



More information about the Python-list mailing list