Skip to content

Commit

Permalink
fix for issue 111. Try block for importing Sequence to account for ol…
Browse files Browse the repository at this point in the history
…der versions of python
  • Loading branch information
ethoms-usgs committed Oct 24, 2024
1 parent 2ee15be commit ad4b787
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Scripts/docx/section.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

from __future__ import absolute_import, division, print_function, unicode_literals

from collections import Sequence
try:
from collections import Sequence
except:
from collections.abc import Sequence

from docx.blkcntnr import BlockItemContainer
from docx.enum.section import WD_HEADER_FOOTER
Expand Down Expand Up @@ -81,7 +84,7 @@ def even_page_footer(self):
The content of this footer definition is ignored unless the document setting
:attr:`~.Settings.odd_and_even_pages_header_footer` is set True.
"""
return _Footer(self._sectPr, self._document_part, WD_HEADER_FOOTER.EVEN_PAGE)
return _Footer(self._sectPr, self._document_part, WD_HEADER_FOOTER.EVEN_PAGE)

@property
def even_page_header(self):
Expand Down Expand Up @@ -394,7 +397,8 @@ def _prior_headerfooter(self):
"""|_Footer| proxy on prior sectPr element or None if this is first section."""
preceding_sectPr = self._sectPr.preceding_sectPr
return (
None if preceding_sectPr is None
None
if preceding_sectPr is None
else _Footer(preceding_sectPr, self._document_part, self._hdrftr_index)
)

Expand Down Expand Up @@ -437,6 +441,7 @@ def _prior_headerfooter(self):
"""|_Header| proxy on prior sectPr element or None if this is first section."""
preceding_sectPr = self._sectPr.preceding_sectPr
return (
None if preceding_sectPr is None
None
if preceding_sectPr is None
else _Header(preceding_sectPr, self._document_part, self._hdrftr_index)
)

0 comments on commit ad4b787

Please sign in to comment.