Import without executing module

Lie Lie.1296 at gmail.com
Tue Feb 3 05:21:56 EST 2009


On Feb 3, 1:37 pm, Ray <rayky... at gmail.com> wrote:
> I'll enclose the top-level commands with the if statement above...its
> just a minor change, but it seems unavoidable.
>
> Thanks again!
>
> Ray

If you really don't want the file to be changed, you could (depends on
the module) use the module as a subprocess. The ideal solution is for
the module to have an if __name__ == '__main__': to determine whether
it is being used as a module or a standalone program though.



More information about the Python-list mailing list