idpass / idpass-card-generator

Automate creating of multiple IDs, badges and cards for different people. Just upload your template and start generating your cards with different information.
Apache License 2.0
1 stars 1 forks source link

FileNotFound Error [Errno 2] No such file or directory: 'rsvg-convert' #75

Open Nagarjunakuchi88 opened 1 year ago

Nagarjunakuchi88 commented 1 year ago

Team,

We deployed the card generator in production. We are able to do operations like uploading the cards and getting the cards. But when we try to render the card '/api/v1/cards/{uuid}/render/', getting below error.

sentry log

Installed 'rsvg-convert' by using apt-get install librsvg2-bin

django log django_1 | INFO 2023-03-01 02:08:20,039 pdf 12 140170532390720 Start rendering #56dbb074-6957-4467-8a7f-3e45174f44b3

FileNotFoundError [Errno 2] No such file or directory: 'rsvg-convert'

FileNotFoundError: [Errno 2] No such file or directory: 'rsvg-convert' File "django/core/handlers/exception.py", line 55, in inner response = get_response(request) File "django/core/handlers/base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, callback_kwargs) File "contextlib.py", line 79, in inner return func(*args, *kwds) File "django/views/decorators/csrf.py", line 54, in wrapped_view return view_func(args, kwargs) File "rest_framework/viewsets.py", line 125, in view return self.dispatch(request, *args, kwargs) File "rest_framework/views.py", line 509, in dispatch response = self.handle_exception(exc) File "rest_framework/views.py", line 469, in handle_exception self.raise_uncaught_exception(exc) File "rest_framework/views.py", line 480, in raise_uncaught_exception raise exc File "rest_framework/views.py", line 506, in dispatch response = handler(request, *args, *kwargs) File "card_generator/api/v1/cards/views.py", line 37, in render return Response(data=serializer.data) File "rest_framework/serializers.py", line 555, in data ret = super().data File "rest_framework/serializers.py", line 255, in data self._data = self.to_representation(self.validated_data) File "rest_framework/serializers.py", line 522, in to_representation ret[field.field_name] = field.to_representation(attribute) File "rest_framework/fields.py", line 1838, in to_representation return method(value) File "card_generator/api/v1/cards/serializers.py", line 52, in get_files return card_render.render() File "card_generator/cards/pdf.py", line 45, in render pdf_name = self.render_pdf(name) File "card_generator/cards/pdf.py", line 70, in render_pdf convert_svgs(self.svg_files, rsvg_pdf, "pdf") File "card_generator/cards/utils.py", line 46, in convert_svgs subprocess.check_call( File "subprocess.py", line 368, in check_call retcode = call(popenargs, kwargs) File "subprocess.py", line 349, in call with Popen(*popenargs, **kwargs) as p: File "subprocess.py", line 951, in init self._execute_child(args, executable, preexec_fn, close_fds, File "subprocess.py", line 1821, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename);

Please Let us know the what we are missing here.

Nagarjunakuchi88 commented 1 year ago

Seems django docker file is not having 'rsvg-convert' dependencies.

Added ''libxml2-dev libxslt-dev librsvg2-bin mupdf-tools' dependency, now its working.

jeremi commented 1 year ago

Great, can you do a PR to add it ?