'Set up any environment changes requested (e.g., Python path
and Django settings), then run this command. If the
command raises a ``CommandError``, intercept it and print it sensibly
to stderr.'

def run_from_argv(self, argv):

    parser = self.create_parser(argv[0], argv[1])
    (options, args) = parser.parse_args(argv[2:])
    handle_default_options(options)
    try:
        self.execute(*args, **options.__dict__)
    except Exception as e:
        stderr = getattr(self, 'stderr', OutputWrapper(sys.stderr, self.style.ERROR))
        if options.traceback:
            stderr.write(traceback.format_exc())
        else:
            stderr.write(('%s:    %s' % (e.__class__.__name__, e)))
        if (options.auto_pdb and (not isinstance(e, KeyboardInterrupt))):
            import pdb
            pdb.post_mortem(sys.exc_info()[2])
        else:
            sys.exit(1)
