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

'lxml.etree._Element' object has no attribute 'Relationship_lst' #1180

Open
tcosmo opened this issue Jan 27, 2023 · 0 comments
Open

'lxml.etree._Element' object has no attribute 'Relationship_lst' #1180

tcosmo opened this issue Jan 27, 2023 · 0 comments

Comments

@tcosmo
Copy link

tcosmo commented Jan 27, 2023

My application uses python-docx in production and we often get the following error:

'lxml.etree._Element' object has no attribute 'Relationship_lst'

Which comes from this piece of code docx/opc/pkgreader.py line 286 (v0.8.11):

@staticmethod
def load_from_xml(baseURI, rels_item_xml):
    """
    Return |_SerializedRelationships| instance loaded with the
    relationships contained in *rels_item_xml*. Returns an empty
    collection if *rels_item_xml* is |None|.
    """
    srels = _SerializedRelationships()
    if rels_item_xml is not None:
        rels_elm = parse_xml(rels_item_xml)
        for rel_elm in rels_elm.Relationship_lst:
            srels._srels.append(_SerializedRelationship(baseURI, rel_elm))
    return srels

Unfortunately, I am not able to reproduce this bug deterministically, it is quite mysterious.

The application is deployed on Google Cloud Run which somehow seems to maybe have an influence here as I have been absolutely unable to reproduce the bug locally.

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

1 participant