def run_query(self, query):
        try:
            json_data = None
            error = None

            query = query.strip()

            script = os.path.join(self.configuration["path"], query.split(" ")[0])
            if not os.path.exists(script):
                return None, "Script '%s' not found in script directory" % query

            script = os.path.join(self.configuration["path"], query)

            output = subprocess.check_output(script.split(" "), shell=False)
            if output is not None:
                output = output.strip()
                if output != "":
                    return output, None

            error = "Error reading output"
        except subprocess.CalledProcessError as e:
            return None, str(e)
        except __HOLE__:
            error = "Query cancelled by user."
            json_data = None
        except Exception as e:
            raise sys.exc_info()[1], None, sys.exc_info()[2]

        return json_data, error
dataset/ETHPy150Open getredash/redash/redash/query_runner/script.py/Script.run_query