[Idle-dev] Re: IDLE command line
Beni Cherniavsky
cben at users.sf.net
Wed Sep 22 23:59:24 CEST 2004
Kurt B. Kaiser wrote:
> Import the module. If it won't import, it's probably not on your
> sys.path; you can cd to the directory containing the .py file before
> you start IDLE.
>
> If the module uses the
>
> if __name__ == "__main__" :
> some_function()
>
> idiom, that should be enough to run it. Otherwise, you will need to
> call some function in the module.
>
Nope, that idiom is intended precisely to *avoid* doing anything when
imported. So if it's using this idiom you *would* need to call
some_function().
Perhaps Kurt meant running it with execfile(), in which case it is run
under '__main__' and the code would run by itself indeed.
More information about the IDLE-dev
mailing list