Skip to content

Commit

Permalink
Prevent console window from closing immediately
Browse files Browse the repository at this point in the history
  • Loading branch information
dev7355608 committed Sep 15, 2017
1 parent a2e00a5 commit a48a75e
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@
DeleteValue)


if getattr(sys, 'frozen', False):
application_path = os.path.dirname(sys.executable)

def press_any_key_to_exit():
try:
input('\nPress any key or CTRL+C to exit...\n')
except KeyboardInterrupt:
pass

atexit.register(press_any_key_to_exit)
elif __file__:
application_path = os.path.dirname(__file__)


def interpolate(value, minimum, maximum):
return min(int(minimum + value * (maximum + 1 - minimum)), maximum)

Expand Down Expand Up @@ -62,11 +76,6 @@ def extract(data, *keys, default=None):
log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)

if getattr(sys, 'frozen', False):
application_path = os.path.dirname(sys.executable)
elif __file__:
application_path = os.path.dirname(__file__)

with open(os.path.join(application_path, 'settings.json')) as f:
settings = json.load(f)

Expand Down

0 comments on commit a48a75e

Please sign in to comment.