Skip to content

no relationship of type ... in collection error #204

@cristian-codorean

Description

@cristian-codorean

Hi, I was trying python-docx with a .docx file which I got from a .doc file 'Saved as' a Strict Open XML Document with Microsoft Office Standard 2013. Unfortunately, when I'm trying to open the .docx file with python-docx, I get the error below. Does anybody have any idea what the problem is ?

Traceback (most recent call last):
  File "fillin_subrep_contract.py", line 39, in <module>
    fillin_contract_docx(sys.argv[1])
  File "fillin_subrep_contract.py", line 20, in fillin_contract_docx
    document = Document(wordfile)
  File "/var/tmp/mow/git/virtualenvs/webdev/lib/python2.7/site-packages/docx/api.py", line 25, in Document
    document_part = Package.open(docx).main_document_part
  File "/var/tmp/mow/git/virtualenvs/webdev/lib/python2.7/site-packages/docx/opc/package.py", line 108, in main_document_part
    return self.part_related_by(RT.OFFICE_DOCUMENT)
  File "/var/tmp/mow/git/virtualenvs/webdev/lib/python2.7/site-packages/docx/opc/package.py", line 127, in part_related_by
    return self.rels.part_with_reltype(reltype)
  File "/var/tmp/mow/git/virtualenvs/webdev/lib/python2.7/site-packages/docx/opc/rel.py", line 63, in part_with_reltype
    rel = self._get_rel_of_type(reltype)
  File "/var/tmp/mow/git/virtualenvs/webdev/lib/python2.7/site-packages/docx/opc/rel.py", line 116, in _get_rel_of_type
    raise KeyError(tmpl % reltype)
KeyError: u"no relationship of type 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument' in collection"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions