if __name__ == '__main__':

53 views
Skip to first unread message

GilRoss

unread,
Apr 26, 2013, 6:07:48 PM4/26/13
to python-o...@googlegroups.com
Without success, I have been trying to use if __name__ == '__main__':. From my debugger the __name__ is equal to "TBD". I'm not sure how to check the value of '__main__'. Is this feature supported? Is there something special that needs to be done?

Thanks,
Gil

pir...@gmail.com

unread,
Apr 26, 2013, 6:34:54 PM4/26/13
to python-o...@googlegroups.com
PyMite currently don't support it, you should check against the
'main()' function instead:

if main():

Maybe Dean would talk about if this feature is near on the horizon...

2013/4/27 GilRoss <gilber...@gmail.com>:
> --
> --
> You are subscribed to the "python-on-a-chip" (or p14p for short) Google
> Group.
> Site: http://groups.google.com/group/python-on-a-chip
>
> ---
> You received this message because you are subscribed to the Google Groups
> "python-on-a-chip" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to python-on-a-ch...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
"Si quieres viajar alrededor del mundo y ser invitado a hablar en un
monton de sitios diferentes, simplemente escribe un sistema operativo
Unix."
– Linus Tordvals, creador del sistema operativo Linux

Dean Hall

unread,
Apr 26, 2013, 8:29:13 PM4/26/13
to python-o...@googlegroups.com
p14p support very few of Python's "magic" things (the things that begin with underscores). The only ones that are supported are the ones that were absolutely required while I was creating the VM.

__name__ is not [yet] supported. In its place you can use the "isMain()" builtin function.

In your module you'd have code like this:

if isMain():
# do main stuff.

!!Dean

GilRoss

unread,
Apr 29, 2013, 12:37:30 PM4/29/13
to python-o...@googlegroups.com
I'm not finding the isMain() builtin. My version is v10 (417).
Gil

Dean Hall

unread,
Apr 29, 2013, 2:26:51 PM4/29/13
to python-o...@googlegroups.com
Sorry, lowercase 'm'.

ismain()

!!Dean
Reply all
Reply to author
Forward
0 new messages