Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error converting docx to pdf #158

Open
CTPassion opened this issue Jan 23, 2025 · 1 comment
Open

Error converting docx to pdf #158

CTPassion opened this issue Jan 23, 2025 · 1 comment

Comments

@CTPassion
Copy link

Hi,

I am running a unoserver as a subprocess from python in my docker container:

unoserver_process = subprocess.Popen(
        ['python', '-m', 'unoserver.server'],
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE
    )

Which works, and the unoconverter service starts up on port 2003. It converted one of my files but the other raises this error:

INFO:lib.filetype_conversion:   🛠️...Converting docx file to pdf
INFO:unoserver:Connecting.
INFO:unoserver:Converting.
ERROR:lib.filetype_conversion:❗Error converting file to PDF: <Fault 1: "<class 'RuntimeError'>:Could not load document <remote file> using the writer8 filter.">
ERROR:Worker:JOB FAILED
Traceback (most recent call last):
  File "/home/server/main.py", line 192, in <module>
    raise e
  File "/home/server/main.py", line 182, in <module>
    main(
  File "/home/server/main.py", line 74, in main
    if process_file(
       ^^^^^^^^^^^^^
  File "/home/server/main.py", line 107, in process_file
    pdf_content = filetype_conversion.convert_docx_to_pdf(content)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/server/lib/filetype_conversion.py", line 68, in convert_docx_to_pdf
    output_byte_str = CLIENT.convert(indata=input_stream.read(), outpath=None,
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/unoserver/client.py", line 142, in convert
    result = proxy.convert(
             ^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/xmlrpc/client.py", line 1122, in __call__
    return self.__send(self.__name, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/xmlrpc/client.py", line 1461, in __request
    response = self.__transport.request(
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/xmlrpc/client.py", line 1166, in request
    return self.single_request(host, handler, request_body, verbose)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/xmlrpc/client.py", line 1182, in single_request
    return self.parse_response(resp)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/xmlrpc/client.py", line 1351, in parse_response
    return u.close()
           ^^^^^^^^^
  File "/usr/lib/python3.12/xmlrpc/client.py", line 668, in close
    raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault 1: "<class 'RuntimeError'>:Could not load document <remote file> using the writer8 filter.">
INFO:lib.filetype_conversion:🤖 Terminating unoserver...

I am getting this error that it can't load document on some of my docx files, but I can't tell why, they seem intact to me. Any ideas what I should try? I can't upload the docx files for privacy reasons.

@regebro
Copy link
Member

regebro commented Jan 24, 2025

Can Libreoffice open those files normally?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants