From bfcf34a95b1de4a7fd8a02b6465da8c73c693760 Mon Sep 17 00:00:00 2001 From: Jehiah Czebotar Date: Tue, 30 May 2017 09:27:15 -0400 Subject: [PATCH] demos/file_uploader: add missing __name__ == __main__ stanza --- demos/file_upload/file_uploader.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) mode change 100644 => 100755 demos/file_upload/file_uploader.py 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)) -- 2.47.2