From 30aab7004d271dce6783db7b128d52922610206b Mon Sep 17 00:00:00 2001 From: Nathan Richard Date: Mon, 1 Oct 2018 16:50:51 +0200 Subject: [PATCH] Avoid importing wx when --ignore-gooey is part of the command line arguments. wx has dependencies on graphical libraries and servers. Importing it on a headless machines causes the scripts to fail. This change allows gooey-powered scripts to run on headless machines with the --ignore-gooey option. --- gooey/python_bindings/gooey_decorator.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gooey/python_bindings/gooey_decorator.py b/gooey/python_bindings/gooey_decorator.py index 7475334..6fe3eb9 100644 --- a/gooey/python_bindings/gooey_decorator.py +++ b/gooey/python_bindings/gooey_decorator.py @@ -11,7 +11,6 @@ import os import sys from argparse import ArgumentParser -from gooey.gui import application from gooey.gui.util.freeze import getResourcePath from gooey.util.functional import merge from . import config_generator @@ -53,6 +52,8 @@ def Gooey(f=None, def build(payload): def run_gooey(self, args=None, namespace=None): + # This import is delayed so it is not in the --ignore-gooey codepath. + from gooey.gui import application source_path = sys.argv[0] build_spec = None