diff --git a/pandora/item/management/commands/get_frame.py b/pandora/item/management/commands/get_frame.py index 94b601e1..69e78e4e 100644 --- a/pandora/item/management/commands/get_frame.py +++ b/pandora/item/management/commands/get_frame.py @@ -11,13 +11,18 @@ from ... import models class Command(BaseCommand): help = 'extract frame and print path' - args = ' ' - def handle(self, id, height, position, **options): + def add_arguments(self, parser): + parser.add_argument('args', metavar='args', type=str, nargs='*', help=' ') + + def handle(self, id, height, position, **kwargs): position = float(position) height = int(height) with transaction.atomic(): - i = models.Item.objects.get(public_id=id) - path = i.frame(position, height) + try: + i = models.Item.objects.get(public_id=id) + path = i.frame(position, height) + except models.Item.DoesNotExist: + path = None if path: print(path)