Skip to content

NumberingPart.new NotImplementedError #1313

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

Open
KaHuier opened this issue Dec 12, 2023 · 1 comment
Open

NumberingPart.new NotImplementedError #1313

KaHuier opened this issue Dec 12, 2023 · 1 comment

Comments

@KaHuier
Copy link

KaHuier commented Dec 12, 2023

the simple code

from docx import Document

doc = Document(r"xxxx.docx")
print(doc.part.numbering_part)

The following issues have occurred

Traceback (most recent call last):
  File "x.py", line 4, in <module>
    print(doc.part.numbering_part)
  File "\mars-win-amd64-python3.9\lib\site-packages\docx\shared.py", line 242, in __get__
    value = self._fget(obj)
  File "\mars-win-amd64-python3.9\lib\site-packages\docx\parts\document.py", line 99, in numbering_part
    numbering_part = NumberingPart.new()
  File "\mars-win-amd64-python3.9\lib\site-packages\docx\parts\numbering.py", line 15, in new
    raise NotImplementedError
NotImplementedError

After investigation, it was found that the 'NumberingPart. new()' used in the 'numbing_part' did not implement the function.

The following is the code used by 'NumberingPart.new()'

class NumberingPart(XmlPart):
    """Proxy for the numbering.xml part containing numbering definitions for a document
    or glossary."""

    @classmethod
    def new(cls):
        """Return newly created empty numbering part, containing only the root
        ``<w:numbering>`` element."""
        raise NotImplementedError
@roydad
Copy link

roydad commented Sep 26, 2024

I have the same problem.

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

2 participants