# Buggy code
def call(self):
    """
    Call the module
    """
    # raet channel here
    ret = {}
    fun = self.opts["fun"]
    ret["jid"] = "{0:%Y%m%d%H%M%S%f}".format(datetime.datetime.now())
    proc_fn = os.path.join(salt.minion.get_proc_dir(self.opts["cachedir"]), ret["jid"])
    if fun not in self.minion.functions:
        sys.stderr.write("Function {0} is not available\n".format(fun))
        sys.exit(-1)
    try:
        sdata = {"fun": fun, "pid": os.getpid(), "jid": ret["jid"], "tgt": "salt-call"}
        args, kwargs = salt.minion.load_args_and_kwargs(
            self.minion.functions[fun],
            salt.utils.args.parse_input(self.opts["arg"]),
            data=sdata,
        )
        try:
            with salt.utils.fopen(proc_fn, "w+b") as fp_:
                fp_.write(self.serial.dumps(sdata))
        except NameError:
            # Don't require msgpack with local
            pass
        except IOError:
            sys.stderr.write(
                "Cannot write to process directory. "
                "Do you have permissions to "
                "write to {0} ?\n".format(proc_fn)
            )
        func = self.minion.functions[fun]
        try:
            ret["return"] = func(*args, **kwargs)
        except TypeError as exc:
            trace = traceback.format_exc()
            sys.stderr.write("Passed invalid arguments: {0}\n".format(exc))
            active_level = LOG_LEVELS.get(self.opts["log_level"].lower(), logging.ERROR)
            if active_level <= logging.DEBUG:
                sys.stderr.write(trace)
            sys.exit(salt.exitcodes.EX_GENERIC)
        try:
            ret["retcode"] = sys.modules[func.__module__].__context__.get("retcode", 0)
        except AttributeError:
            ret["retcode"] = 1
    except CommandExecutionError as exc:
        msg = "Error running '{0}': {1}\n"
        active_level = LOG_LEVELS.get(self.opts["log_level"].lower(), logging.ERROR)
        if active_level <= logging.DEBUG:
            sys.stderr.write(traceback.format_exc())
        sys.stderr.write(msg.format(fun, str(exc)))
        sys.exit(salt.exitcodes.EX_GENERIC)
    except CommandNotFoundError as exc:
        msg = "Command required for '{0}' not found: {1}\n"
        sys.stderr.write(msg.format(fun, str(exc)))
        sys.exit(salt.exitcodes.EX_GENERIC)
    try:
        os.remove(proc_fn)
    except (IOError, OSError):
        pass
    if hasattr(self.minion.functions[fun], "__outputter__"):
        oput = self.minion.functions[fun].__outputter__
        if isinstance(oput, string_types):
            ret["out"] = oput
    is_local = self.opts["local"] or self.opts.get("file_client", False) == "local"
    returners = self.opts.get("return", "").split(",")
    if (not is_local) or returners:
        ret["id"] = self.opts["id"]
        ret["fun"] = fun
        ret["fun_args"] = self.opts["arg"]

    for returner in returners:
        try:
            ret["success"] = True
            self.minion.returners["{0}.returner".format(returner)](ret)
        except Exception:
            pass

    # return the job infos back up to the respective minion's master

    if not is_local:
        try:
            mret = ret.copy()
            mret["jid"] = "req"
            self.return_pub(mret)
        except Exception:
            pass
    # close raet channel here
    return ret


# Traceback (ImportError)
2015-02-07 12:58:41,254 [salt.loaded.int.module.cmdmod][DEBUG   ] output: File not found - C:\salt\var\cache\salt\minion\highstate.p
2015-02-07 12:58:41,254 [salt.loader      ][DEBUG   ] Failed to import returner :
Traceback (most recent call last):
File "salt/loader.py", line 621, in gen_module
ImportError: No module named

# Fixed code
def call(self):
    """
    Call the module
    """
    # raet channel here
    ret = {}
    fun = self.opts["fun"]
    ret["jid"] = "{0:%Y%m%d%H%M%S%f}".format(datetime.datetime.now())
    proc_fn = os.path.join(salt.minion.get_proc_dir(self.opts["cachedir"]), ret["jid"])
    if fun not in self.minion.functions:
        sys.stderr.write("Function {0} is not available\n".format(fun))
        sys.exit(-1)
    try:
        sdata = {"fun": fun, "pid": os.getpid(), "jid": ret["jid"], "tgt": "salt-call"}
        args, kwargs = salt.minion.load_args_and_kwargs(
            self.minion.functions[fun],
            salt.utils.args.parse_input(self.opts["arg"]),
            data=sdata,
        )
        try:
            with salt.utils.fopen(proc_fn, "w+b") as fp_:
                fp_.write(self.serial.dumps(sdata))
        except NameError:
            # Don't require msgpack with local
            pass
        except IOError:
            sys.stderr.write(
                "Cannot write to process directory. "
                "Do you have permissions to "
                "write to {0} ?\n".format(proc_fn)
            )
        func = self.minion.functions[fun]
        try:
            ret["return"] = func(*args, **kwargs)
        except TypeError as exc:
            trace = traceback.format_exc()
            sys.stderr.write("Passed invalid arguments: {0}\n".format(exc))
            active_level = LOG_LEVELS.get(self.opts["log_level"].lower(), logging.ERROR)
            if active_level <= logging.DEBUG:
                sys.stderr.write(trace)
            sys.exit(salt.exitcodes.EX_GENERIC)
        try:
            ret["retcode"] = sys.modules[func.__module__].__context__.get("retcode", 0)
        except AttributeError:
            ret["retcode"] = 1
    except CommandExecutionError as exc:
        msg = "Error running '{0}': {1}\n"
        active_level = LOG_LEVELS.get(self.opts["log_level"].lower(), logging.ERROR)
        if active_level <= logging.DEBUG:
            sys.stderr.write(traceback.format_exc())
        sys.stderr.write(msg.format(fun, str(exc)))
        sys.exit(salt.exitcodes.EX_GENERIC)
    except CommandNotFoundError as exc:
        msg = "Command required for '{0}' not found: {1}\n"
        sys.stderr.write(msg.format(fun, str(exc)))
        sys.exit(salt.exitcodes.EX_GENERIC)
    try:
        os.remove(proc_fn)
    except (IOError, OSError):
        pass
    if hasattr(self.minion.functions[fun], "__outputter__"):
        oput = self.minion.functions[fun].__outputter__
        if isinstance(oput, string_types):
            ret["out"] = oput
    is_local = self.opts["local"] or self.opts.get("file_client", False) == "local"
    returners = self.opts.get("return", "").split(",")
    if (not is_local) or returners:
        ret["id"] = self.opts["id"]
        ret["fun"] = fun
        ret["fun_args"] = self.opts["arg"]

    for returner in returners:
        if not returner:  # if we got an empty returner somehow, skip
            continue
        try:
            ret["success"] = True
            self.minion.returners["{0}.returner".format(returner)](ret)
        except Exception:
            pass

    # return the job infos back up to the respective minion's master

    if not is_local:
        try:
            mret = ret.copy()
            mret["jid"] = "req"
            self.return_pub(mret)
        except Exception:
            pass
    # close raet channel here
    return ret