So i am making a flask web app and i added a docx to pdf converter but its not working every time i will ran into a problem even though it is simple so i am using this python package to convert docx to pdf <https://pypi.org/project/docx2pdf/> and i made it till where i upload files in flask and it start converting. I get error when converting it

this is my code

```
@app.route("/pdf", methods=["POST"])
def pdf2docx_post():
    file = request.files['file']

    if file and allowed_file(file.filename):
        filename = file.filename
        file.save(secure_filename(filename))
        convert(filename, filename.split('.')[0] + '.docx')

        convert(filename, "output.pdf")
        convert(filename)
        return send_file("output.pdf", as_attachment=True)

        return render_template("pdf.html", wait="Pleas wait your download will start automatically")

```

i get this error

```
Traceback (most recent call last):
  File "C:\Users\UwU\OneDrive\Desktop\UwU web\Web Development\all-in-one-tools\tools-web\Lib\site-packages\flask\app.py", line 2091, in __call__
    return self.wsgi_app(environ, start_response)
  File "C:\Users\UwU\OneDrive\Desktop\UwU web\Web Development\all-in-one-tools\tools-web\Lib\site-packages\flask\app.py", line 2076, in wsgi_app
    response = self.handle_exception(e)
  File "C:\Users\UwU\OneDrive\Desktop\UwU web\Web Development\all-in-one-tools\tools-web\Lib\site-packages\flask\app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Users\UwU\OneDrive\Desktop\UwU web\Web Development\all-in-one-tools\tools-web\Lib\site-packages\flask\app.py", line 1518, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Users\UwU\OneDrive\Desktop\UwU web\Web Development\all-in-one-tools\tools-web\Lib\site-packages\flask\app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Users\UwU\OneDrive\Desktop\UwU web\Web Development\all-in-one-tools\tools-web\Lib\site-packages\flask\app.py", line 1502, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "C:\Users\UwU\OneDrive\Desktop\UwU web\Web Development\all-in-one-tools\app\main.py", line 145, in pdf2docx_post
    convert(filename, filename.split('.')[0] + '.docx')
  File "C:\Users\UwU\OneDrive\Desktop\UwU web\Web Development\all-in-one-tools\tools-web\Lib\site-packages\docx2pdf\__init__.py", line 102, in convert
    paths = resolve_paths(input_path, output_path)
  File "C:\Users\UwU\OneDrive\Desktop\UwU web\Web Development\all-in-one-tools\tools-web\Lib\site-packages\docx2pdf\__init__.py", line 94, in resolve_paths
    assert str(output_path).endswith(".pdf")
AssertionError

```

Thanks in advance

**NOTE: I ALREADY USED MANY STACKOVERFLOW ANSWERS BUT IT DIDNT WORKED**