algoo / preview-generator

generates previews of files with cache management
https://pypi.org/project/preview-generator/
MIT License
226 stars 50 forks source link

Failed to generate thumbnails of pptx #234

Closed tonypottera24 closed 3 years ago

tonypottera24 commented 3 years ago

I've got a problem to generate thumbnails of a pptx file.

preview-generator==0.20

MIME type: application/vnd.openxmlformats-officedocument.presentationml.presentation

error message: Both macOS and Linux:

saving attachment Presentation1.pptx
Builder <class 'preview_generator.preview.builder.document__scribus.DocumentPreviewBuilderScribus'> is missing a dependency: this builder requires scribus to be available
Builder <class 'preview_generator.preview.builder.document__drawio.ImagePreviewBuilderDrawio'> is missing a dependency: this builder requires xvfb-run to be available
Builder <class 'preview_generator.preview.builder.cad__vtk.ImagePreviewBuilderVtk'> is missing a dependency: this builder requires vtk to be available
Attachment save [Errno 2] No such file or directory: '/tmp/preview_cache/e086aa0a4696941334fe734550eb441d.pdf'
def gen_thumbnail(upload):
    cache_path = '/tmp/preview_cache'
    from preview_generator.extension import mimetypes_storage
    mimetypes_storage.add_type(
        'application/vnd.openxmlformats-officedocument.wordprocessingml.document', '.docx')
    mimetypes_storage.add_type(
        'application/vnd.openxmlformats-officedocument.presentationml.presentation', '.pptx')

    from preview_generator.manager import PreviewManager
    manager = PreviewManager(cache_path, create_folder=True)
    with tempfile.NamedTemporaryFile() as fp:
        for chunk in upload.chunks():
            fp.write(chunk)
        fp.seek(0)
        path_to_preview_image = manager.get_jpeg_preview(
            fp.name, width=1024, height=1024)

    with open(path_to_preview_image, 'rb') as fp:
        buffer = BytesIO(fp.read())
        buffer.seek(0)
        return InMemoryUploadedFile(buffer, 'ImageField', "%s.jpg" % upload.name.split('.')[0], 'image/jpeg',
                                    len(buffer.getbuffer()), None)

Anyone knows how to fix it?

Sample file: Presentation1.pptx

raphj commented 3 years ago

Does the folder /tmp/preview_cache exist? Can you try this?

mkdir /tmp/preview_cache

This is where Preview-Generator's cache is (your cache_path variable)

tonypottera24 commented 3 years ago

@raphj Thanks for your reply. I've add Path(cache_path).mkdir(parents=True, exist_ok=True) and got same error.

tonypottera24 commented 3 years ago

I think create_folder=True also does same work

raphj commented 3 years ago

Do you have a sample file that does not work that you would be willing to attach here, by chance?

Does preview-generator work on other formats?

tonypottera24 commented 3 years ago

@raphj Thank you for your help. It works well on pdf and other image formats such as svg, jpg, png.

It also works on Microsoft Word after I add this line.

mimetypes_storage.add_type(
        'application/vnd.openxmlformats-officedocument.wordprocessingml.document', '.docx')

I did the same for pptx to help preview_generator to recognize it as pptx.

mimetypes_storage.add_type(
        'application/vnd.openxmlformats-officedocument.presentationml.presentation', '.pptx')

A sample file is attached. Presentation1.pptx

tonypottera24 commented 3 years ago

Is there any way to increase the log level or print more debug messages?

raphj commented 3 years ago

Works for me with this code (with the mimetypes lines commented out or enabled):

def gen_thumbnail():
    cache_path = '/tmp/preview_cache'
    from preview_generator.extension import mimetypes_storage
    #mimetypes_storage.add_type(
    #    'application/vnd.openxmlformats-officedocument.wordprocessingml.document', '.docx')
    #mimetypes_storage.add_type(
    #    'application/vnd.openxmlformats-officedocument.presentationml.presentation', '.pptx')

    from preview_generator.manager import PreviewManager
    manager = PreviewManager(cache_path, create_folder=True)
    path_to_preview_image = manager.get_jpeg_preview(
        "/tmp/Presentation1.pptx", width=1024, height=1024
    )
    print(path_to_preview_image)

gen_thumbnail()

Output:

Builder <class 'preview_generator.preview.builder.document__scribus.DocumentPreviewBuilderScribus'> is missing a dependency: this builder requires scribus to be available
Builder <class 'preview_generator.preview.builder.document__drawio.ImagePreviewBuilderDrawio'> is missing a dependency: this builder requires xvfb-run to be available
Builder <class 'preview_generator.preview.builder.cad__vtk.ImagePreviewBuilderVtk'> is missing a dependency: this builder requires vtk to be available
/tmp/preview_cache/b70e58f765055600086d1f97109eb3c3-1024x1024.jpeg

On Ubuntu 20.04, preview-generator 0.20. This produces a white square thumbnail with the black word "TEST" centered in it.

Can you try this code, and maybe give us more information on your OS, installation and versions? What version of libreoffice do you have?

raphj commented 3 years ago

Attachment save [Errno 2] No such file or directory: '/tmp/preview_cache/e086aa0a4696941334fe734550eb441d.pdf'

It is strange that you get a PDF extension here, it should be a JPEG extension.

lebouquetin commented 3 years ago

@raphj pptx to jpeg is processed through a pdf pivot file.

raphj commented 3 years ago

indeed, but manager.get_jpeg_preview returns a path to a jpeg file on my installation when I give it a path to Presentation1.pptx.

@tonypottera24 what is the value of fp.name in your code?

raphj commented 3 years ago

@tonypottera24 you may want to try providing a suffix parameter to tempfile.NamedTemporaryFile

tonypottera24 commented 3 years ago

Works for me with this code (with the mimetypes lines commented out or enabled):

def gen_thumbnail():
    cache_path = '/tmp/preview_cache'
    from preview_generator.extension import mimetypes_storage
    #mimetypes_storage.add_type(
    #    'application/vnd.openxmlformats-officedocument.wordprocessingml.document', '.docx')
    #mimetypes_storage.add_type(
    #    'application/vnd.openxmlformats-officedocument.presentationml.presentation', '.pptx')

    from preview_generator.manager import PreviewManager
    manager = PreviewManager(cache_path, create_folder=True)
    path_to_preview_image = manager.get_jpeg_preview(
        "/tmp/Presentation1.pptx", width=1024, height=1024
    )
    print(path_to_preview_image)

gen_thumbnail()

Output:

Builder <class 'preview_generator.preview.builder.document__scribus.DocumentPreviewBuilderScribus'> is missing a dependency: this builder requires scribus to be available
Builder <class 'preview_generator.preview.builder.document__drawio.ImagePreviewBuilderDrawio'> is missing a dependency: this builder requires xvfb-run to be available
Builder <class 'preview_generator.preview.builder.cad__vtk.ImagePreviewBuilderVtk'> is missing a dependency: this builder requires vtk to be available
/tmp/preview_cache/b70e58f765055600086d1f97109eb3c3-1024x1024.jpeg

On Ubuntu 20.04, preview-generator 0.20. This produces a white square thumbnail with the black word "TEST" centered in it.

Can you try this code, and maybe give us more information on your OS, installation and versions? What version of libreoffice do you have?

This code gives the following output

Builder <class 'preview_generator.preview.builder.document__scribus.DocumentPreviewBuilderScribus'> is missing a dependency: this builder requires scribus to be available
Builder <class 'preview_generator.preview.builder.document__drawio.ImagePreviewBuilderDrawio'> is missing a dependency: this builder requires xvfb-run to be available
Builder <class 'preview_generator.preview.builder.cad__vtk.ImagePreviewBuilderVtk'> is missing a dependency: this builder requires vtk to be available
Traceback (most recent call last):
  File "test.py", line 17, in <module>
    gen_thumbnail()
  File "test.py", line 11, in gen_thumbnail
    path_to_preview_image = manager.get_jpeg_preview(
  File "venv/lib/python3.9/site-packages/preview_generator/manager.py", line 192, in get_jpeg_preview
    file_path = self.get_pdf_preview(file_path=file_path, force=force)
  File "venv/lib/python3.9/site-packages/preview_generator/manager.py", line 237, in get_pdf_preview
    preview_context.builder.build_pdf_preview(
  File "venv/lib/python3.9/site-packages/preview_generator/preview/builder/document_generic.py", line 103, in build_pdf_preview
    self._convert_to_pdf(
  File "venv/lib/python3.9/site-packages/preview_generator/preview/builder/office__libreoffice.py", line 86, in _convert_to_pdf
    return self.convert_office_document_to_pdf(
  File "venv/lib/python3.9/site-packages/preview_generator/preview/builder/office__libreoffice.py", line 202, in convert_office_document_to_pdf
    with open(output_filepath, "rb") as pdf_handle:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/preview_cache/ccca05d79885c5d34cebdbc013d733a4.pdf'
tonypottera24 commented 3 years ago

@tonypottera24 you may want to try providing a suffix parameter to tempfile.NamedTemporaryFile

This is a good idea. It becomes

Builder <class 'preview_generator.preview.builder.document__scribus.DocumentPreviewBuilderScribus'> is missing a dependency: this builder requires scribus to be available
Builder <class 'preview_generator.preview.builder.document__drawio.ImagePreviewBuilderDrawio'> is missing a dependency: this builder requires xvfb-run to be available
Builder <class 'preview_generator.preview.builder.cad__vtk.ImagePreviewBuilderVtk'> is missing a dependency: this builder requires vtk to be available
fp.name /var/folders/9h/lp36t37d5710z2qjdc7vf_d00000gn/T/tmprvyfsfb_.pptx
Attachment save [Errno 2] No such file or directory: '/tmp/preview_cache/720bbcc2317a571a3373c4fce7cc5d27.pdf'
tonypottera24 commented 3 years ago

On my macbook LibreOffice 7.0.5.2 64390860c6cd0aca4beafafcfd84613dd9dfb63a

My python codes are packed in a docker and it gives similar error.

# The Google App Engine python runtime is Debian Jessie with Python installed
# and various os-level packages to allow installation of popular Python
# libraries. The source is on github at:
# https://github.com/GoogleCloudPlatform/python-docker
FROM asia.gcr.io/google_appengine/python

# preview
RUN apt-get update
RUN apt-get install -y python3 python3-pip python3-venv
RUN apt-get install -y \
    zlib1g-dev \
    libjpeg-dev \
    python-pythonmagick \
    python3-magic \
    python3-vtk7 \
    inkscape \
    xvfb \
    poppler-utils \
    libfile-mimeinfo-perl \
    qpdf \
    libimage-exiftool-perl \
    ufraw-batch \
    ffmpeg \
    scribus \
    libreoffice \
    language-pack-ja \
    japan* \
    language-pack-zh* \
    chinese* \
    language-pack-ko \
    korean* \
    fonts-arphic-ukai \
    fonts-arphic-uming \
    fonts-ipafont-mincho \
    fonts-ipafont-gothic \
    fonts-unfonts-core

RUN apt-get install -y netcat

# set imagemagick security
RUN sed -i 's/domain="coder" rights="none"/domain="coder" rights="read"/' /etc/ImageMagick-6/policy.xml

# cleanup apt
RUN rm -rf /var/lib/apt/lists/*

# Create a virtualenv for the application dependencies.
# # If you want to use Python 2, use the -p python2.7 flag.
# RUN virtualenv -p python3 /env
RUN python3 -m venv /env
ENV PATH /env/bin:$PATH

ADD requirements.txt /app/requirements.txt
RUN /env/bin/pip install --upgrade pip && /env/bin/pip install -r /app/requirements.txt
ADD . /app

CMD ./production/run.sh
# [END docker]
raphj commented 3 years ago

What does manager.get_jpeg_preview return? a path to a PDF file?

raphj commented 3 years ago

Can you check that the contents of the temporary file matches what you expect? You could use a breakpoint() to suspend your execution and compute the md5sum of your file.

tonypottera24 commented 3 years ago

Can you check that the contents of the temporary file matches what you expect? You could use a breakpoint() to suspend your execution and compute the md5sum of your file.

Yes, the MD5 shows same result

md5 /var/folders/9h/lp36t37d5710z2qjdc7vf_d00000gn/T/tmpqm62ugz8.pptx
MD5 (/var/folders/9h/lp36t37d5710z2qjdc7vf_d00000gn/T/tmpqm62ugz8.pptx) = 07fdce7d44845a3089c66d0dc5e79543

md5 Presentation1.pptx
MD5 (Presentation1.pptx) = 07fdce7d44845a3089c66d0dc5e79543
tonypottera24 commented 3 years ago

What does manager.get_jpeg_preview return? a path to a PDF file?

yes, but it failed before I got the path.

tonypottera24 commented 3 years ago

Works for me with this code (with the mimetypes lines commented out or enabled):

def gen_thumbnail():
    cache_path = '/tmp/preview_cache'
    from preview_generator.extension import mimetypes_storage
    #mimetypes_storage.add_type(
    #    'application/vnd.openxmlformats-officedocument.wordprocessingml.document', '.docx')
    #mimetypes_storage.add_type(
    #    'application/vnd.openxmlformats-officedocument.presentationml.presentation', '.pptx')

    from preview_generator.manager import PreviewManager
    manager = PreviewManager(cache_path, create_folder=True)
    path_to_preview_image = manager.get_jpeg_preview(
        "/tmp/Presentation1.pptx", width=1024, height=1024
    )
    print(path_to_preview_image)

gen_thumbnail()

Output:

Builder <class 'preview_generator.preview.builder.document__scribus.DocumentPreviewBuilderScribus'> is missing a dependency: this builder requires scribus to be available
Builder <class 'preview_generator.preview.builder.document__drawio.ImagePreviewBuilderDrawio'> is missing a dependency: this builder requires xvfb-run to be available
Builder <class 'preview_generator.preview.builder.cad__vtk.ImagePreviewBuilderVtk'> is missing a dependency: this builder requires vtk to be available
/tmp/preview_cache/b70e58f765055600086d1f97109eb3c3-1024x1024.jpeg

On Ubuntu 20.04, preview-generator 0.20. This produces a white square thumbnail with the black word "TEST" centered in it. Can you try this code, and maybe give us more information on your OS, installation and versions? What version of libreoffice do you have?

This code gives the following output

Builder <class 'preview_generator.preview.builder.document__scribus.DocumentPreviewBuilderScribus'> is missing a dependency: this builder requires scribus to be available
Builder <class 'preview_generator.preview.builder.document__drawio.ImagePreviewBuilderDrawio'> is missing a dependency: this builder requires xvfb-run to be available
Builder <class 'preview_generator.preview.builder.cad__vtk.ImagePreviewBuilderVtk'> is missing a dependency: this builder requires vtk to be available
Traceback (most recent call last):
  File "test.py", line 17, in <module>
    gen_thumbnail()
  File "test.py", line 11, in gen_thumbnail
    path_to_preview_image = manager.get_jpeg_preview(
  File "venv/lib/python3.9/site-packages/preview_generator/manager.py", line 192, in get_jpeg_preview
    file_path = self.get_pdf_preview(file_path=file_path, force=force)
  File "venv/lib/python3.9/site-packages/preview_generator/manager.py", line 237, in get_pdf_preview
    preview_context.builder.build_pdf_preview(
  File "venv/lib/python3.9/site-packages/preview_generator/preview/builder/document_generic.py", line 103, in build_pdf_preview
    self._convert_to_pdf(
  File "venv/lib/python3.9/site-packages/preview_generator/preview/builder/office__libreoffice.py", line 86, in _convert_to_pdf
    return self.convert_office_document_to_pdf(
  File "venv/lib/python3.9/site-packages/preview_generator/preview/builder/office__libreoffice.py", line 202, in convert_office_document_to_pdf
    with open(output_filepath, "rb") as pdf_handle:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/preview_cache/ccca05d79885c5d34cebdbc013d733a4.pdf'

Maybe the problem is in the pptx -> pdf part?

raphj commented 3 years ago

yes, but it failed before I got the path.

Ah, interesting.

Maybe the problem is in the pptx -> pdf part?

From the trace you give in your last message, it seems so.

I'd be interested to reproduce your Docker setup (I might not have time to investigate in the next few days). Would you be willing to provide us your Docker context folder? (everything next to your Dockerfile to reproduce the issue)

raphj commented 3 years ago

Any chance the pdf is not actually produced in /tmp/preview_cache but in one of your folders that looks like /var/folders/9h/lp36t37d5710z2qjdc7vf_d00000gn/T/?

Preview-Generator uses Python's logging module to log debug messages, you can try to raise the debug level with something like this: https://stackoverflow.com/a/38537983

tonypottera24 commented 3 years ago

Any chance the pdf is not actually produced in /tmp/preview_cache but in one of your folders that looks like /var/folders/9h/lp36t37d5710z2qjdc7vf_d00000gn/T/?

Preview-Generator uses Python's logging module to log debug messages, you can try to raise the debug level with something like this: https://stackoverflow.com/a/38537983

The sample code you provided gives following output.

DEBUG:PreviewGenerator:Builder module loading: office__libreoffice
INFO:PreviewGenerator:Builder module loaded: office__libreoffice
DEBUG:PreviewGenerator:Builder module loading: plain_text
INFO:PreviewGenerator:Builder module loaded: plain_text
DEBUG:PreviewGenerator:Builder module loading: document__sketch
INFO:PreviewGenerator:Builder module loaded: document__sketch
DEBUG:PreviewGenerator:Builder module loading: archive__zip
INFO:PreviewGenerator:Builder module loaded: archive__zip
DEBUG:PreviewGenerator:Builder module loading: document__drawio
INFO:PreviewGenerator:Builder module loaded: document__drawio
DEBUG:PreviewGenerator:Builder module loading: document_generic
INFO:PreviewGenerator:Builder module loaded: document_generic
DEBUG:PreviewGenerator:Builder module loading: cad__vtk
INFO:PreviewGenerator:Builder module loaded: cad__vtk
DEBUG:PreviewGenerator:Builder module loading: image__pillow
INFO:PreviewGenerator:Builder module loaded: image__pillow
DEBUG:PreviewGenerator:Builder module loading: image__wand
INFO:PreviewGenerator:Builder module loaded: image__wand
DEBUG:PreviewGenerator:Builder module loading: image__inkscape
INFO:PreviewGenerator:Builder module loaded: image__inkscape
DEBUG:PreviewGenerator:Builder module loading: document__scribus
INFO:PreviewGenerator:Builder module loaded: document__scribus
DEBUG:PreviewGenerator:Builder module loading: image__cairosvg
INFO:PreviewGenerator:Builder module loaded: image__cairosvg
DEBUG:PreviewGenerator:Builder module loading: image__imconvert
INFO:PreviewGenerator:Builder module loaded: image__imconvert
DEBUG:PreviewGenerator:Builder module loading: video__ffmpeg
INFO:PreviewGenerator:Builder module loaded: video__ffmpeg
DEBUG:PreviewGenerator:Builder module loading: pdf__pypdf2
INFO:PreviewGenerator:Builder module loaded: pdf__pypdf2
INFO:PreviewGenerator:Skipping builder class [<class 'preview_generator.preview.generic_preview.OnePagePreviewBuilder'>]: method get_supported_mimetypes is not implemented
INFO:PreviewGenerator:Skipping builder class [<class 'preview_generator.preview.generic_preview.ImagePreviewBuilder'>]: method get_supported_mimetypes is not implemented
DEBUG:PreviewGenerator:register builder for image/png: ImagePreviewBuilderPillow
DEBUG:PreviewGenerator:register builder for application/postscript: ImagePreviewBuilderPillow
DEBUG:PreviewGenerator:register builder for image/x-eps: ImagePreviewBuilderPillow
DEBUG:PreviewGenerator:register builder for image/x-sony-arw: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-ms-bmp: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-canon-cr2: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-canon-crw: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-kodak-dcr: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-adobe-dng: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for application/msword: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-epson-erf: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/gif: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/heic: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/vnd.microsoft.icon: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/jpeg: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for application/json: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-kodak-k25: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-kodak-kdc: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-minolta-mrw: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-nikon-nef: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-olympus-orf: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-portable-bitmap: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-pentax-pef: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-portable-graymap: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/png: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-portable-anymap: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-portable-pixmap: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-fuji-raf: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-cmu-raster: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-panasonic-raw: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-rgb: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-panasonic-rw2: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-sony-sr2: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-sony-srf: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/tiff: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-sigma-x3f: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-xbitmap: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-xpixmap: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-xwindowdump: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for application/x-xcf: ImagePreviewBuilderIMConvert
DEBUG:PreviewGenerator:register builder for image/x-xcf: ImagePreviewBuilderIMConvert
INFO:PreviewGenerator:New Preview builder of class<class 'preview_generator.preview.builder.image__imconvert.ImagePreviewBuilderIMConvert'>
DEBUG:PreviewGenerator:register builder for image/x-ms-bmp: ImagePreviewBuilderWand
DEBUG:PreviewGenerator:register builder for application/msword: ImagePreviewBuilderWand
DEBUG:PreviewGenerator:register builder for image/gif: ImagePreviewBuilderWand
DEBUG:PreviewGenerator:register builder for image/heic: ImagePreviewBuilderWand
DEBUG:PreviewGenerator:register builder for image/vnd.microsoft.icon: ImagePreviewBuilderWand
DEBUG:PreviewGenerator:register builder for image/jpeg: ImagePreviewBuilderWand
DEBUG:PreviewGenerator:register builder for application/json: ImagePreviewBuilderWand
DEBUG:PreviewGenerator:register builder for image/x-portable-bitmap: ImagePreviewBuilderWand
DEBUG:PreviewGenerator:register builder for image/x-portable-graymap: ImagePreviewBuilderWand
DEBUG:PreviewGenerator:register builder for image/png: ImagePreviewBuilderWand
DEBUG:PreviewGenerator:register builder for image/x-portable-anymap: ImagePreviewBuilderWand
DEBUG:PreviewGenerator:register builder for image/x-portable-pixmap: ImagePreviewBuilderWand
DEBUG:PreviewGenerator:register builder for image/x-cmu-raster: ImagePreviewBuilderWand
DEBUG:PreviewGenerator:register builder for image/x-rgb: ImagePreviewBuilderWand
DEBUG:PreviewGenerator:register builder for image/tiff: ImagePreviewBuilderWand
DEBUG:PreviewGenerator:register builder for image/x-xbitmap: ImagePreviewBuilderWand
DEBUG:PreviewGenerator:register builder for image/x-xpixmap: ImagePreviewBuilderWand
DEBUG:PreviewGenerator:register builder for image/x-xwindowdump: ImagePreviewBuilderWand
DEBUG:PreviewGenerator:register builder for image/svg+xml: ImagePreviewBuilderInkscape
DEBUG:PreviewGenerator:register builder for image/svg: ImagePreviewBuilderInkscape
DEBUG:PreviewGenerator:register builder for image/svg+xml: ImagePreviewBuilderCairoSVG
DEBUG:PreviewGenerator:register builder for image/svg: ImagePreviewBuilderCairoSVG
DEBUG:PreviewGenerator:register builder for application/x-compressed: ZipPreviewBuilder
DEBUG:PreviewGenerator:register builder for application/x-zip-compressed: ZipPreviewBuilder
DEBUG:PreviewGenerator:register builder for application/zip: ZipPreviewBuilder
DEBUG:PreviewGenerator:register builder for multipart/x-zip: ZipPreviewBuilder
DEBUG:PreviewGenerator:register builder for application/x-tar: ZipPreviewBuilder
DEBUG:PreviewGenerator:register builder for application/x-gzip: ZipPreviewBuilder
DEBUG:PreviewGenerator:register builder for application/x-gtar: ZipPreviewBuilder
DEBUG:PreviewGenerator:register builder for application/x-tgz: ZipPreviewBuilder
INFO:PreviewGenerator:Skipping builder class [<class 'preview_generator.preview.builder.document_generic.DocumentPreviewBuilder'>]: method get_supported_mimetypes is not implemented
DEBUG:PreviewGenerator:register builder for application/vnd.oasis.opendocument.chart: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.oasis.opendocument.chart-template: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.oasis.opendocument.formula: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.oasis.opendocument.formula-template: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.oasis.opendocument.graphics: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.oasis.opendocument.graphics-template: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.oasis.opendocument.graphics-flat-xml: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.oasis.opendocument.presentation: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.oasis.opendocument.presentation-template: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.oasis.opendocument.presentation-flat-xml: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.oasis.opendocument.spreadsheet: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.oasis.opendocument.spreadsheet-template: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.oasis.opendocument.spreadsheet-flat-xml: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.oasis.opendocument.text: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.oasis.opendocument.text-flat-xml: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.oasis.opendocument.text-master: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.oasis.opendocument.text-template: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.oasis.opendocument.text-master-template: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.oasis.opendocument.text-web: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.sun.xml.calc: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.sun.xml.calc.template: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.sun.xml.chart: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.sun.xml.draw: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.sun.xml.draw.template: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.sun.xml.impress: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.sun.xml.impress.template: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.sun.xml.math: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.sun.xml.writer: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.sun.xml.writer.global: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.sun.xml.writer.template: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.sun.xml.writer.web: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/rtf: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for text/rtf: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/msword: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.ms-powerpoint: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.ms-excel: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.ms-excel.sheet.binary.macroEnabled.12: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.ms-excel.sheet.macroEnabled.12: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.ms-excel.template.macroEnabled.12: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.ms-powerpoint.presentation.macroEnabled.12: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.ms-powerpoint.slide.macroEnabled.12: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.ms-powerpoint.slideshow.macroEnabled.12: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.ms-powerpoint.template.macroEnabled.12: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.ms-word.document.macroEnabled.12: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.ms-word.template.macroEnabled.12: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.openxmlformats-officedocument.spreadsheetml.sheet: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.openxmlformats-officedocument.spreadsheetml.template: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.openxmlformats-officedocument.presentationml.presentation: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.openxmlformats-officedocument.presentationml.template: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.openxmlformats-officedocument.presentationml.slideshow: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.openxmlformats-officedocument.presentationml.slide: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.openxmlformats-officedocument.wordprocessingml.document: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.openxmlformats-officedocument.wordprocessingml.template: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.visio: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/visio.drawing: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.visio2013: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.visio.xml: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/x-mspublisher: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/wps-office.doc: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/wps-office.docx: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/wps-office.xls: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/wps-office.xlsx: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/wps-office.ppt: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/wps-office.pptx: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/xhtml+xml: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/mathml+xml: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for text/html: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/docbook+xml: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for text/csv: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for text/spreadsheet: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/x-qpro: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/x-dbase: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.corel-draw: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.lotus-wordpro: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.lotus-1-2-3: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.wordperfect: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/wordperfect5.1: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.ms-works: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/clarisworks: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/macwriteii: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.apple.keynote: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.apple.numbers: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.apple.pages: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/x-iwork-keynote-sffkey: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/x-iwork-numbers-sffnumbers: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/x-iwork-pages-sffpages: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/x-hwp: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/x-aportisdoc: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/prs.plucker: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.palm: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/x-sony-bbeb: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/x-pocket-word: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/x-t602: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/x-fictionbook+xml: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/x-abiword: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/x-pagemaker: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/x-gnumeric: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.stardivision.calc: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.stardivision.draw: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/vnd.stardivision.writer: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/x-starcalc: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/x-stardraw: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for application/x-starwriter: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/x-freehand: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/cgm: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/tif: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/tiff: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/vnd.dxf: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/emf: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/x-emf: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/x-targa: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/x-sgf: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/x-svm: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/wmf: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/x-wmf: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/x-pict: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/x-cmx: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/x-wpg: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/x-eps: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/x-met: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/x-portable-bitmap: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/x-photo-cd: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/x-pcx: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/x-portable-graymap: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/x-portable-pixmap: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/vnd.adobe.photoshop: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/x-cmu-raster: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/x-sun-raster: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/x-xbitmap: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for image/x-xpixmap: OfficePreviewBuilderLibreoffice
DEBUG:PreviewGenerator:register builder for text/plain: PlainTextPreviewBuilder
DEBUG:PreviewGenerator:register builder for text/html: PlainTextPreviewBuilder
DEBUG:PreviewGenerator:register builder for text/xml: PlainTextPreviewBuilder
DEBUG:PreviewGenerator:register builder for application/xml: PlainTextPreviewBuilder
DEBUG:PreviewGenerator:register builder for application/javascript: PlainTextPreviewBuilder
ERROR:PreviewGenerator:Builder <class 'preview_generator.preview.builder.document__scribus.DocumentPreviewBuilderScribus'> is missing a dependency: this builder requires scribus to be available
DEBUG:PreviewGenerator:register builder for application/sketch: ImagePreviewBuilderSketch
ERROR:PreviewGenerator:Builder <class 'preview_generator.preview.builder.document__drawio.ImagePreviewBuilderDrawio'> is missing a dependency: this builder requires xvfb-run to be available
ERROR:PreviewGenerator:Builder <class 'preview_generator.preview.builder.cad__vtk.ImagePreviewBuilderVtk'> is missing a dependency: this builder requires vtk to be available
DEBUG:PreviewGenerator:register builder for application/x-videolan: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/3gpp: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/annodex: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/dl: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/dv: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/fli: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/gl: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/mpeg: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/mp2t: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/mp4: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/quicktime: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/mp4v-es: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/ogg: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/parityfec: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/pointer: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/webm: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/vnd.fvt: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/vnd.motorola.video: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/vnd.motorola.videop: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/vnd.mpegurl: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/vnd.mts: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/vnd.nokia.interleaved-multimedia: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/vnd.vivo: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/x-flv: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/x-la-asf: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/x-mng: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/x-ms-asf: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/x-ms-wm: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/x-ms-wmv: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/x-ms-wmx: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/x-ms-wvx: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/x-msvideo: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/x-sgi-movie: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/x-matroska: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/x-theora+ogg: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for video/x-m4v: VideoPreviewBuilderFFMPEG
DEBUG:PreviewGenerator:register builder for application/pdf: PdfPreviewBuilderPyPDF2
INFO:PreviewGenerator:New Preview builder of class<class 'preview_generator.preview.builder.office__libreoffice.OfficePreviewBuilderLibreoffice'>
INFO:PreviewGenerator:New Preview builder of class<class 'preview_generator.preview.builder.office__libreoffice.OfficePreviewBuilderLibreoffice'>
DEBUG:filelock:Attempting to acquire lock 4596412224 on /tmp/preview_cache/ccca05d79885c5d34cebdbc013d733a4.lock
INFO:filelock:Lock 4596412224 acquired on /tmp/preview_cache/ccca05d79885c5d34cebdbc013d733a4.lock
DEBUG:PreviewGenerator:converting file bytes <_io.BufferedReader name='/tmp/Presentation1.pptx'> to pdf file /tmp/preview_cache/ccca05d79885c5d34cebdbc013d733a4.pdf
DEBUG:PreviewGenerator:conversion is based on temporary file /tmp/preview_cache/ccca05d79885c5d34cebdbc013d733a4.pdf.pptx
DEBUG:PreviewGenerator:temporary file written: /tmp/preview_cache/ccca05d79885c5d34cebdbc013d733a4.pdf.pptx
DEBUG:PreviewGenerator:converting /tmp/preview_cache/ccca05d79885c5d34cebdbc013d733a4.pdf.pptx to pdf into folder /tmp/preview_cache/
DEBUG:filelock:Attempting to acquire lock 4597209168 on /tmp/preview_cache/libreoffice.lock
INFO:filelock:Lock 4597209168 acquired on /tmp/preview_cache/libreoffice.lock
DEBUG:filelock:Attempting to release lock 4597209168 on /tmp/preview_cache/libreoffice.lock
INFO:filelock:Lock 4597209168 released on /tmp/preview_cache/libreoffice.lock
INFO:PreviewGenerator:Removing temporary copy file /tmp/preview_cache/ccca05d79885c5d34cebdbc013d733a4.pdf.pptx
DEBUG:filelock:Attempting to release lock 4596412224 on /tmp/preview_cache/ccca05d79885c5d34cebdbc013d733a4.lock
INFO:filelock:Lock 4596412224 released on /tmp/preview_cache/ccca05d79885c5d34cebdbc013d733a4.lock
Traceback (most recent call last):
  File "config/test.py", line 22, in <module>
    gen_thumbnail()
  File "config/test.py", line 16, in gen_thumbnail
    path_to_preview_image = manager.get_jpeg_preview(
  File "venv/lib/python3.9/site-packages/preview_generator/manager.py", line 192, in get_jpeg_preview
    file_path = self.get_pdf_preview(file_path=file_path, force=force)
  File "venv/lib/python3.9/site-packages/preview_generator/manager.py", line 237, in get_pdf_preview
    preview_context.builder.build_pdf_preview(
  File "venv/lib/python3.9/site-packages/preview_generator/preview/builder/document_generic.py", line 103, in build_pdf_preview
    self._convert_to_pdf(
  File "venv/lib/python3.9/site-packages/preview_generator/preview/builder/office__libreoffice.py", line 86, in _convert_to_pdf
    return self.convert_office_document_to_pdf(
  File "venv/lib/python3.9/site-packages/preview_generator/preview/builder/office__libreoffice.py", line 202, in convert_office_document_to_pdf
    with open(output_filepath, "rb") as pdf_handle:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/preview_cache/ccca05d79885c5d34cebdbc013d733a4.pdf'
tonypottera24 commented 3 years ago

yes, but it failed before I got the path.

Ah, interesting.

Maybe the problem is in the pptx -> pdf part?

From the trace you give in your last message, it seems so.

I'd be interested to reproduce your Docker setup (I might not have time to investigate in the next few days). Would you be willing to provide us your Docker context folder? (everything next to your Dockerfile to reproduce the issue)

I can produce a jpeg preview on my ubuntu server by your sample code, but it just doesn'g work on my mac and the python docker.

raphj commented 3 years ago

I know it can be tricky inside Docker, but are you able to open file venv/lib/python3.9/site-packages/preview_generator/preview/builder/office__libreoffice.py, add a breakpoint right before line 196 with contextlib.suppress(FileNotFoundError): and see if the PDF file exists at this point in the code? Do you know if your docker image works on your Ubuntu host?

tonypottera24 commented 3 years ago

I found the problem on my macbook. I used a symlink to link /Applications/LibreOffice.app/Contents/MacOS/soffice to /usr/bin/local/libreoffice I run the conversion command manually, and it shows this error message. https://superuser.com/questions/1078968/libreoffice-on-os-x-running-soffice-keeps-saying-no-info-plist-or-no-nsprincipa

After I replace /usr/bin/local/libreoffice by the shell script they suggested, I can produce jpeg preview on my mac correctly.

raphj commented 3 years ago

This is good to know, thanks for the information. I thought you were using a docker image, do you know why Preview-Generator ended up using your Mac version of LibreOffice?

@lebouquetin @inkhey should we add a warning to Mac users to the README?

raphj commented 3 years ago

We probably should also add a check when calling LibreOffice that the expected files are there.

tonypottera24 commented 3 years ago

This is good to know, thanks for the information. I thought you were using a docker image, do you know why Preview-Generator ended up using your Mac version of LibreOffice?

@lebouquetin @inkhey should we add a warning to Mac users to the README?

I use Preview-Generator both on my mac and in the Docker.

tonypottera24 commented 3 years ago

I've identified the problem to celery in the Docker. A jpeg thumbnail can be generated in the Docker correctly. However, if the code is executed by a celery worker in the same container, the file not found error happens.

tonypottera24 commented 3 years ago

https://github.com/celery/celery/issues/891 maybe related

tonypottera24 commented 3 years ago

To get more debug info, https://github.com/algoo/preview-generator/blob/develop/preview_generator/preview/builder/office__libreoffice.py Add the following. from subprocess import PIPE replace the

process = Popen(
...
stdout=DEVNULL,
stderr=STDOUT,
...

by

process = Popen(
...
stdout=PIPE,
stderr=PIPE,
...

and replace

process.communicate(timeout=process_timeout)

by

stdout, stderr = process.communicate(timeout=process_timeout)
print('stdout', stdout)
print('stderr', stderr)
tonypottera24 commented 3 years ago

@raphj I found out that, both docx and pptx, gives empty string as stdout and stderr

raphj commented 3 years ago

Interesting. Do you know what exit status the process gave? Or if it timed out?

tonypottera24 commented 3 years ago

@raphj it returned 137... After I increase the memory limit, it works as expected. Thank you for your help.

raphj commented 3 years ago

Oh, this is a memory issue then? Good to know! Would you be willing to give us the numbers?

I'd like to let you know that I haven't had time to look into your problem at the beginning of this week but this was a very interesting investigation to follow.

You started some investigations on how to make Preview-Generator more willing to give debug information, feel free to open a PR on this or to share us your ideas if you want to.

tonypottera24 commented 3 years ago

To get more debug info, https://github.com/algoo/preview-generator/blob/develop/preview_generator/preview/builder/office__libreoffice.py Add the following. from subprocess import PIPE replace the

process = Popen(
...
stdout=DEVNULL,
stderr=STDOUT,
...

by

process = Popen(
...
stdout=PIPE,
stderr=PIPE,
...

Since it is a Docker, so I use sed to replace replace

process.communicate(timeout=process_timeout)

by

print("process.communicate", process.communicate(timeout=process_timeout), process.returncode)
tonypottera24 commented 3 years ago

I got memory issue on "256Mi", but larger than "384Mi" works well.

inkhey commented 3 years ago

Thank for the feedback, note: this issue is related to #241 as part of the issue is macOS related.