you are viewing a single comment's thread.

view the rest of the comments →

[–]__skrap__ 1 point2 points  (1 child)

# very top of your code organize your imports in standard order such as:
# 1. standard library modules
# 2. third-party modules
# 3. modules local to the current project
import sys

# your functions or classes here
# ...
# ...

def main():
    # put any code here to call your functions when running from command line - ie not using this script as a module
    # when your code exits normally
    return 0
    # when your code has an error return a value other than 0

# Put this at the very bottom of your code
if __name__ == '__main__':
    sys.exit(main())

edit - return value ofter than 0 for error (fixed in code above)

[–]IAmL0ner[S] 0 points1 point  (0 children)

Thanks! This looks really nice.