Nov-05-2020, 03:50 PM
An error message without context is not very useful. There is only one place "encode" is used in this code.
I do not know why that would return None. Is the problem that "report_element" could not find "report_format" and thus the "tail" is not defined? Why would that be? Is this what happens when the requested report could not be found? We have no way to know since we don't know anything at all about pdf-report.gmp.py.
This code looks like it is part of a package, a commercial software package. I assume the code works, but you have not provided that information. If the code works then the problem is either that it cannot find the report, or that the report is not in a format that could be processed. In either case I would expect better reporting, but the script just assumes everything is fine and doesn't appear to do any error reporting at all.
Sorry that I can't help you any more.
report_element = response.find("report") # get the full content of the report element content = report_element.find("report_format").tail # convert content to 8-bit ASCII bytes binary_base64_encoded_pdf = content.encode('ascii')The message you are receiving would indicate that "content" is None, which would indicate that this
report_element.find("report_format").tail
returns None.I do not know why that would return None. Is the problem that "report_element" could not find "report_format" and thus the "tail" is not defined? Why would that be? Is this what happens when the requested report could not be found? We have no way to know since we don't know anything at all about pdf-report.gmp.py.
This code looks like it is part of a package, a commercial software package. I assume the code works, but you have not provided that information. If the code works then the problem is either that it cannot find the report, or that the report is not in a format that could be processed. In either case I would expect better reporting, but the script just assumes everything is fine and doesn't appear to do any error reporting at all.
Sorry that I can't help you any more.