def execute(self, *args, **options):
        if len(args) != 1:
            raise CommandError("You must provide a file to import!")

        self.site = options["site"]
        if not isinstance(self.site, Site):
            try:
                self.site = Site.objects.get(domain=options["site"])
            except __HOLE__:
                raise CommandError("No site found for domain: %s"
                                   % options["site"])

        filepath = args[0]

        if filepath == '-':
            rows = _get_rows(sys.stdin)
            _create_redirects(self.site, rows)
        else:
            try:
                with open(filepath) as fp:
                    rows = _get_rows(fp)
                    _create_redirects(self.site, rows)

            except IOError as e:
                if e.errno == errno.ENOENT:
                    raise CommandError("The specified file does not exist!")
                else:
                    raise
dataset/ETHPy150Open okfn/foundation/foundation/redirector/management/commands/import_redirect_csv.py/Command.execute