'Unauthorized' error using convert_word_to_pdf(


I get the this error when I try run convert_word_to_pdf().

Do you know why this is? I’ve turned off our office firewall to test as well.


Hi @charlie.mottmac , can you provide some more information on what happens inside the function download_report? In order to see where the problem might be it would also be very helpful to see what parameters you feed into convert_word_to_pdf, where those parameters come from and what their types are

    def download_report(self,params,entity_id,**kwargs):
        result = self.create_report(params,entity_id)
        storage = Storage()
            # Add docs to a zip file
            zip_dict = {}
            report = result[0].read()
            storage.set('pdf_data', data=File.from_data(report), scope='entity')
            pdf = convert_word_to_pdf(report)
            zip_dict[params.intro_step.report_name + ".pdf"] = pdf
            zip_dict[result[1]] = result[0]
            for child in API().get_entity(entity_id).children():
            return DownloadResult(zipped_files=zip_dict, file_name=params.intro_step.report_name + ".zip")
        except Exception as err:
            if len(API().get_entity(entity_id).children()) < 1:
                raise UserException("You haven't uploaded any images. Click the back arrow in the top left corner and 'create' images for the report.")
                raise UserException(err)

@charlie.mottmac it seems unlikely that the error is raised when hitting the line with convert_word_to_pdf. Authorization problems might arise when you try to perform an action that you are not authorized to perform. This may be for example:

  • Accessing an entity that you may not access according to the user management settings from the application
  • Deleting an entity that you may not delete

Can you verify that you indeed have the right permissions to delete the entity?

Certain it is happening at the convert to pdf stage. I’ve tested with removing the code to delete the entities, still no luck. It did work previously without any issue

@charlie.mottmac ok, thnx for checking. In that case there must be something about the authorization of the file itself. Could you remove the try-except clause, and check what the actual error message is? Furthermore, what is the type of result[0]? You can find out by:

I will raise this issue with our platform team. If it is a bug in the convert_word_to_pdf function, with the information above they will hopefully be able to replicate the issue. Thanks for your help!


I noticed that you use the read() function withoud a context manager. I believe this is implicitly opening the file (you should close it manually after reading it, ór use a context manager. Maybe this could be the cause of your autorization problems.

Kind Regards