Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Executable

Karyna Reut
Karyna Reut
1,611 Points

Where to try Dunder Main? How to download it?

I work on PyCharm and have downloaded PowerShell there but in the terminal I still could not run the code, like in the video.

Travis Alstrand
seal-mask
.a{fill-rule:evenodd;}techdegree
Travis Alstrand
Treehouse Teacher

You can also follow along and download the project files in the "Downloads" tab right underneath the video :smiley:

1 Answer

Travis Alstrand
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Travis Alstrand
Treehouse Teacher

Hey Karyna Reut !

So Dunder Main isn't anything that needs to be downloaded, and you can read more about it here in the docs if you'd like!

I use the statement if __name__ == '__main__': down at the bottom of my main script where I have access to the logic that I want ran upon running the app. Underneath it (and (nested) indented to the right) I call the functions that need to be ran and in the correct order to get the app running correctly. For example...

def awesome_function(string_variable):
    print(string_variable)

def startup_function():
    awesome_function("So Much AWESOME!")

if __name__ == '__main__':
    startup_function()
Karyna Reut
Karyna Reut
1,611 Points

Thank you (●'◡'●)