1

I am trying to deploy a Flask application to Azure Web App Service. I am running Windows OS but Azure App Services only supports Python on Linux. I am getting errors whenever it loads the python modules that involve conversion of .docx to pdf. My container crashes and I get the following message:

:( Application Error
If you are the application administrator, you can access the diagnostic resources.

Below are the error messages I observe from the logs

I have tried docx2pdf and I got this error:

"/opt/python/3.9.0/lib/python3.9/importlib/metadata.py", line 511, in read_text
return self._path.joinpath(filename).read_text(encoding='utf-8')
AttributeError: 'PosixPath' object has no attribute 'read_text'

I tried comtypes and got this error:

File "/tmp/8d97989fbb07031/antenv/lib/python3.9/site-packages/comtypes/__init__.py", line 23, in <module>
from _ctypes import COMError
ImportError: cannot import name 'COMError' from '_ctypes' 

I am running on python 3.9.7. and for deployment I have tried the azure CLI on both Windows Powershell and VScode, and I've also tried deploying from Github but I'm still getting the same errors.

Is there anyway to solve the issues I have encountered? Or is there another way I can convert a docx file to pdf in linux using python?

Trelaquix
  • 63
  • 11

0 Answers0