diff --git a/examples/client_query_from_string.py b/examples/client_query_from_string.py index c3b348a..5445160 100644 --- a/examples/client_query_from_string.py +++ b/examples/client_query_from_string.py @@ -5,6 +5,7 @@ """ import json +import sys import time import besapi @@ -85,6 +86,12 @@ def main(): previous_result = str(query_result) i += 1 + + # if not running interactively: + # https://stackoverflow.com/questions/2356399/tell-if-python-is-in-interactive-mode + if not sys.__stdin__.isatty(): + print("not interactive, stopping loop") + break except KeyboardInterrupt: print("loop interuppted")