Python Forum
question about if __name__=="__main__"
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
question about if __name__=="__main__"
#1
I am working on a scraper, I've made the class, and written the driver under if __name__ == '__main__': My question is, and sorry if it's basic, I'm newish to programming, why is it when I change that to def main(): , and include an if __name__ == '__main__': followed by main(), the program has errors.

I've done a little searching on the topic to get my own answers, but I think I'm not asking the question correctly. Thank you for any help you can give.
Reply


Messages In This Thread
question about if __name__=="__main__" - by aaander - Nov-13-2022, 12:43 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  __name__ and __main__ in functions Mark17 3 808 Oct-12-2023, 01:55 AM
Last Post: deanhystad
  if __name__=='__main__' albin2005 3 2,193 Sep-07-2021, 09:21 AM
Last Post: albin2005
  Questions about __name__ SheeppOSU 3 2,343 Jul-11-2019, 12:51 PM
Last Post: DeaD_EyE
  ModuleNotFoundError: No module named '__main__.vtt'; '__main__' is not a package MM2018 26 17,132 Oct-12-2018, 05:40 AM
Last Post: MM2018
  Why do we use __main__ when we can call a function directly? Dave7Swift 5 3,897 Jun-04-2018, 05:01 AM
Last Post: Dave7Swift
  Problem with __main__ sylas 2 2,826 Mar-30-2018, 07:51 PM
Last Post: snippsat
  [split] can't find '__main__' module Blue Dog 1 9,536 Oct-18-2016, 12:23 AM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020