[Chandler-dev] if __name__ == "__builtin__"
Phillip J. Eby
pje at telecommunity.com
Mon Mar 27 11:46:15 PST 2006
At 02:42 PM 3/27/2006 -0500, Reid Ellis wrote:
>I've been testing using the PyShell inside Chandler, and I've noticed
>that if I call "execfile()" like I've been doing to test, the value
>of __name__ is not "__main__" when the file is execute. Rather, it is
>"__builtin__". So at the moment at the end of my MultiStateButton.py
>file I have:
> if __name__ == "__main__" or __name__ == "__builtin__":
>followed by code that exercises the button.
>Can I check it in this way? Or should I strip out the latter test? Or
>remove the test to another place entirely?
Strip the latter test, and just do this:
More information about the chandler-dev