In Python (with Turtle) repl, __name__ == "main" rather than "__main__"

Problem description:

For Python scripts in Python (with Turtle) Repl’s the special name __name__ has a value of “main” rather than the expected "__main__" this causes scripts that use condition if __name__ == "__main__": to execute code only if the script is executed independently rather than imported to fail.

Expected behavior:

The value of __name__ for the running script should be "__main__".

Actual behavior:

The value of __name__ for the running script is "main".

Steps to reproduce:

Create a new Python (with Turtle) repl. At the bottom of the file, enter the following code:

if __name__ == "__main__":
   print('Hello world!')

This code should print “Hello World!” but it will not do so because the condition is not met, as it should be.

Browser: Safari 17.0, Chrome 117.0.5938.149
OS: MacOS Sonoma 14.0
Desktop app version (Avatar menu->“Version”) or NA: NA
Plan (Free, Hacker, Pro Plan): Free

Hello. I wasn’t able to reproduce the bug. Could you share the link to your repl or a repl that has the bug?
(Also, use backticks (``) around your symbols so you can put dunder __name__ instead of name (the underscores are interpreted as bolding in markdown))


In the sidebar, click ⋮ > “Show hidden files”. Replace your .replit file:

entrypoint = ""
modules = ["python-with-prybar-3.10:v2-20230925-77b13e4"]

hidden = [".pythonlibs"]

channel = "stable-23_05"

And then you might want to remove the venv folder as in the new system it’s replaced by .pythonlibs