The backend raises an internal error when trying to upload a PDF file.
Internal Server Error: /api/v1/associations/media/
Traceback (most recent call last):
File "C:\Users\louis\Desktop\Portail-des-eleves\backend\venv\lib\site-packages\pdf2image\pdf2image.py", line 420, in pdfinfo_from_path
proc = Popen(command, env=env, stdout=PIPE, stderr=PIPE)
File "C:\Users\louis\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 800, in __init__
restore_signals, start_new_session)
File "C:\Users\louis\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 1207, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] Le fichier spécifié est introuvable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\louis\Desktop\Portail-des-eleves\backend\venv\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
response = get_response(request)
File "C:\Users\louis\Desktop\Portail-des-eleves\backend\venv\lib\site-packages\django\core\handlers\base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "C:\Users\louis\Desktop\Portail-des-eleves\backend\venv\lib\site-packages\django\core\handlers\base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\louis\Desktop\Portail-des-eleves\backend\venv\lib\site-packages\django\views\decorators\csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "C:\Users\louis\Desktop\Portail-des-eleves\backend\venv\lib\site-packages\rest_framework\viewsets.py", line 114, in view
return self.dispatch(request, *args, **kwargs)
File "C:\Users\louis\Desktop\Portail-des-eleves\backend\venv\lib\site-packages\rest_framework\views.py", line 505, in dispatch
response = self.handle_exception(exc)
File "C:\Users\louis\Desktop\Portail-des-eleves\backend\venv\lib\site-packages\rest_framework\views.py", line 465, in handle_exception
self.raise_uncaught_exception(exc)
File "C:\Users\louis\Desktop\Portail-des-eleves\backend\venv\lib\site-packages\rest_framework\views.py", line 476, in raise_uncaught_exception
raise exc
File "C:\Users\louis\Desktop\Portail-des-eleves\backend\venv\lib\site-packages\rest_framework\views.py", line 502, in dispatch
response = handler(request, *args, **kwargs)
File "C:\Users\louis\Desktop\Portail-des-eleves\backend\venv\lib\site-packages\rest_framework\mixins.py", line 19, in create
self.perform_create(serializer)
File "C:\Users\louis\Desktop\Portail-des-eleves\backend\associations\views\media.py", line 46, in perform_create
file=self.request.data["file"],
File "C:\Users\louis\Desktop\Portail-des-eleves\backend\venv\lib\site-packages\rest_framework\serializers.py", line 212, in save
self.instance = self.create(validated_data)
File "C:\Users\louis\Desktop\Portail-des-eleves\backend\venv\lib\site-packages\rest_framework\serializers.py", line 948, in create
instance = ModelClass._default_manager.create(**validated_data)
File "C:\Users\louis\Desktop\Portail-des-eleves\backend\venv\lib\site-packages\django\db\models\manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "C:\Users\louis\Desktop\Portail-des-eleves\backend\venv\lib\site-packages\django\db\models\query.py", line 422, in create
obj.save(force_insert=True, using=self.db)
File "C:\Users\louis\Desktop\Portail-des-eleves\backend\venv\lib\site-packages\django\db\models\base.py", line 744, in save
force_update=force_update, update_fields=update_fields)
File "C:\Users\louis\Desktop\Portail-des-eleves\backend\venv\lib\site-packages\django\db\models\base.py", line 793, in save_base
update_fields=update_fields, raw=raw, using=using,
File "C:\Users\louis\Desktop\Portail-des-eleves\backend\venv\lib\site-packages\django\dispatch\dispatcher.py", line 175, in send
for receiver in self._live_receivers(sender)
File "C:\Users\louis\Desktop\Portail-des-eleves\backend\venv\lib\site-packages\django\dispatch\dispatcher.py", line 175, in <listcomp>
for receiver in self._live_receivers(sender)
File "C:\Users\louis\Desktop\Portail-des-eleves\backend\associations\models\media.py", line 104, in create_preview
image = convert_from_path(instance.file.path, last_page=1)[0]
File "C:\Users\louis\Desktop\Portail-des-eleves\backend\venv\lib\site-packages\pdf2image\pdf2image.py", line 94, in convert_from_path
page_count = pdfinfo_from_path(pdf_path, userpw, poppler_path=poppler_path)["Pages"]
File "C:\Users\louis\Desktop\Portail-des-eleves\backend\venv\lib\site-packages\pdf2image\pdf2image.py", line 442, in pdfinfo_from_path
"Unable to get page count. Is poppler installed and in PATH?"
pdf2image.exceptions.PDFInfoNotInstalledError: Unable to get page count. Is poppler installed and in PATH?
[05/Apr/2022 21:46:31] "POST /api/v1/associations/media/ HTTP/1.1" 500 29572
However, it seems that the file is correctly uploaded.
No preview is available but we can nevertheless download the file (good point).
The internal error should be fixed and a PDF display added.
The backend raises an internal error when trying to upload a PDF file.
However, it seems that the file is correctly uploaded.
No preview is available but we can nevertheless download the file (good point).
The internal error should be fixed and a PDF display added.