Skip to content

custom_xml_parts not available on Linux #1419

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

Closed
gundarsk opened this issue Jul 30, 2024 · 1 comment
Closed

custom_xml_parts not available on Linux #1419

gundarsk opened this issue Jul 30, 2024 · 1 comment

Comments

@gundarsk
Copy link

gundarsk commented Jul 30, 2024

Document object is missing part.custom_xml_parts on Linux.
I have the same code on Windows and Ubuntu. The same repo and the same file.
On Windows, Document instance under part returns custom_xml_parts. Under Linux there is no such field in parts.

from docx import Document
from lxml import etree
import datetime

# read document in IOByte
doc = Document('samples/Document-00.docx')

# This code fails on Linux and works on Windows on the same docx file. On Linux there is not such field custom_xml_parts
custom_xml_parts = doc.part.custom_xml_parts
# list all custom_xml_parts
Xea_xml = None
for i, custom_xml in enumerate(custom_xml_parts):
    # check if exists attrib "author" and it is "XXX"
    if (custom_xml.attrib.get('author') == 'XXX'):
        Xea_xml = custom_xml
        break```
 
@scanny
Copy link
Contributor

scanny commented Jul 30, 2024

I expect you're working on a fork that added DocumentPart.custom_xml_parts. There is no such attribute in this project.

@scanny scanny closed this as completed Jul 30, 2024
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