How to use the ipdb.runcall function in ipdb

To help you get started, we’ve selected a few ipdb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github benmezger / pydebug / pydebug / pdb.py View on Github external
def debug_func(self, *args, **kwargs):
        if not self.on_error:
            return runcall(self.func, *args, **kwargs)
        try:
            if has_ipdb:
                with launch_ipdb_on_exception():
                    return self.func(*args, **kwargs)
            else:
                return self.func(*args, **kwargs)
        except Exception as e:
            traceback.print_exc(file=sys.stderr)
            Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__).set_trace()
github ronghanghu / speaker_follower / tasks / R2R / utils.py View on Github external
subprocess.call("git rev-parse HEAD", shell=True, stdout=out_file)
        subprocess.call("git --no-pager diff", shell=True, stdout=out_file)
        out_file.write('\n\n')
        out_file.write(' '.join(sys.argv))
        out_file.write('\n\n')
        json.dump(vars(args), out_file)
        out_file.write('\n\n')

    log(sys.stdout)
    # if 'save_dir' in vars(args) and args.save_dir:
    #     with open(os.path.join(args.save_dir, 'invoke.log'), 'w') as f:
    #         log(f)

    if args.ipdb:
        import ipdb
        ipdb.runcall(entry_function, args)
    elif args.pdb:
        import pdb
        pdb.runcall(entry_function, args)
    else:
        entry_function(args)