From: Jehiah Czebotar Date: Tue, 30 May 2017 13:27:15 +0000 (-0400) Subject: demos/file_uploader: add missing __name__ == __main__ stanza X-Git-Tag: v5.0.0~18^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bfcf34a95b1de4a7fd8a02b6465da8c73c693760;p=thirdparty%2Ftornado.git demos/file_uploader: add missing __name__ == __main__ stanza --- diff --git a/demos/file_upload/file_uploader.py b/demos/file_upload/file_uploader.py old mode 100644 new mode 100755 index 967896941..9f1f84d51 --- a/demos/file_upload/file_uploader.py +++ b/demos/file_upload/file_uploader.py @@ -100,13 +100,14 @@ def put(filenames): print(response) -define("put", type=bool, help="Use PUT instead of POST", group="file uploader") +if __name__ == "__main__": + define("put", type=bool, help="Use PUT instead of POST", group="file uploader") -# Tornado configures logging from command line opts and returns remaining args. -filenames = options.parse_command_line() -if not filenames: - print("Provide a list of filenames to upload.", file=sys.stderr) - sys.exit(1) + # Tornado configures logging from command line opts and returns remaining args. + filenames = options.parse_command_line() + if not filenames: + print("Provide a list of filenames to upload.", file=sys.stderr) + sys.exit(1) -method = put if options.put else post -ioloop.IOLoop.current().run_sync(lambda: method(filenames)) + method = put if options.put else post + ioloop.IOLoop.current().run_sync(lambda: method(filenames))