Title: Error while loading the docx(KeyError: "There is no item named 'word/#_top' in the archive") · Issue #1351 · python-openxml/python-docx · GitHub
Open Graph Title: Error while loading the docx(KeyError: "There is no item named 'word/#_top' in the archive") · Issue #1351 · python-openxml/python-docx
X Title: Error while loading the docx(KeyError: "There is no item named 'word/#_top' in the archive") · Issue #1351 · python-openxml/python-docx
Description: Hello Team we are using below code to load the document from docx import Document # Path to your DOCX file docx_file_path = 'myfile.docx' # Load the DOCX file document = Document(docx_file_path) # Example: Print all the text in the docum...
Open Graph Description: Hello Team we are using below code to load the document from docx import Document # Path to your DOCX file docx_file_path = 'myfile.docx' # Load the DOCX file document = Document(docx_file_path) # ...
X Description: Hello Team we are using below code to load the document from docx import Document # Path to your DOCX file docx_file_path = 'myfile.docx' # Load the DOCX file document = Document(docx_file_...
Opengraph URL: https://github.com/python-openxml/python-docx/issues/1351
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Error while loading the docx(KeyError: \"There is no item named 'word/#_top' in the archive\")","articleBody":"Hello Team we are using below code to load the document \r\n\r\n```\r\nfrom docx import Document\r\n\r\n# Path to your DOCX file\r\ndocx_file_path = 'myfile.docx'\r\n\r\n# Load the DOCX file\r\ndocument = Document(docx_file_path)\r\n\r\n# Example: Print all the text in the document\r\nfor para in document.paragraphs:\r\n print(para.text)\r\n```\r\n\r\n\r\nGetting below error:\r\n\r\n```\r\nKeyError Traceback (most recent call last)~\\AppData\\Local\\Temp\\ipykernel_13540\\1987488543.py in \u003cmodule\u003e 5 6 # Load the DOCX file----\u003e 7 document = Document(docx_file_path) 8 9 # Example: Print all the text in the document~\\Anaconda3\\lib\\site-packages\\docx\\api.py in Document(docx) 21 \"\"\" 22 docx = _default_docx_path() if docx is None else docx---\u003e 23 document_part = Package.open(docx).main_document_part 24 if document_part.content_type != CT.WML_DOCUMENT_MAIN: 25 tmpl = \"file '%s' is not a Word file, content type is '%s'\"~\\Anaconda3\\lib\\site-packages\\docx\\opc\\package.py in open(cls, pkg_file) 114 def open(cls, pkg_file): 115 \"\"\"Return an |OpcPackage| instance loaded with the contents of `pkg_file`.\"\"\"--\u003e 116 pkg_reader = PackageReader.from_file(pkg_file) 117 package = cls() 118 Unmarshaller.unmarshal(pkg_reader, package, PartFactory)~\\Anaconda3\\lib\\site-packages\\docx\\opc\\pkgreader.py in from_file(pkg_file) 23 content_types = _ContentTypeMap.from_xml(phys_reader.content_types_xml) 24 pkg_srels = PackageReader._srels_for(phys_reader, PACKAGE_URI)---\u003e 25 sparts = PackageReader._load_serialized_parts( 26 phys_reader, pkg_srels, content_types 27 )~\\Anaconda3\\lib\\site-packages\\docx\\opc\\pkgreader.py in _load_serialized_parts(phys_reader, pkg_srels, content_types) 51 sparts = [] 52 part_walker = PackageReader._walk_phys_parts(phys_reader, pkg_srels)---\u003e 53 for partname, blob, reltype, srels in part_walker: 54 content_type = content_types[partname] 55 spart = _SerializedPart(partname, content_type, reltype, blob, srels)~\\Anaconda3\\lib\\site-packages\\docx\\opc\\pkgreader.py in _walk_phys_parts(phys_reader, srels, visited_partnames) 84 phys_reader, part_srels, visited_partnames 85 )---\u003e 86 for partname, blob, reltype, srels in next_walker: 87 yield (partname, blob, reltype, srels) 88 \r\n~\\Anaconda3\\lib\\site-packages\\docx\\opc\\pkgreader.py in _walk_phys_parts(phys_reader, srels, visited_partnames) 84 phys_reader, part_srels, visited_partnames 85 )---\u003e 86 for partname, blob, reltype, srels in next_walker: 87 yield (partname, blob, reltype, srels) 88 \r\n~\\Anaconda3\\lib\\site-packages\\docx\\opc\\pkgreader.py in _walk_phys_parts(phys_reader, srels, visited_partnames) 79 reltype = srel.reltype 80 part_srels = PackageReader._srels_for(phys_reader, partname)---\u003e 81 blob = phys_reader.blob_for(partname) 82 yield (partname, blob, reltype, part_srels) 83 next_walker = PackageReader._walk_phys_parts(~\\Anaconda3\\lib\\site-packages\\docx\\opc\\phys_pkg.py in blob_for(self, pack_uri) 81 Raises |ValueError| if no matching member is present in zip archive. 82 \"\"\"---\u003e 83 return self._zipf.read(pack_uri.membername) 84 85 def close(self):~\\Anaconda3\\lib\\zipfile.py in read(self, name, pwd) 1470 def read(self, name, pwd=None): 1471 \"\"\"Return file bytes for name.\"\"\"-\u003e 1472 with self.open(name, \"r\", pwd) as fp: 1473 return fp.read() 1474 \r\n~\\Anaconda3\\lib\\zipfile.py in open(self, name, mode, pwd, force_zip64) 1509 else: 1510 # Get info object for name-\u003e 1511 zinfo = self.getinfo(name) 1512 1513 if mode == 'w':~\\Anaconda3\\lib\\zipfile.py in getinfo(self, name) 1436 info = self.NameToInfo.get(name)\r\n 1437 if info is None:\r\n-\u003e 1438 raise KeyError(\r\n 1439 'There is no item named %r in the archive' % name)\r\n 1440 \r\n\r\nKeyError: \"There is no item named 'word/#_top' in the archive\"\r\n```\r\n\r\n\r\nLet me know am i doing anything wrong, also it will be helpful if u provide some suggestion to resolve this issue\r\n\r\n\r\n","author":{"url":"https://github.com/akash97715","@type":"Person","name":"akash97715"},"datePublished":"2024-02-29T16:11:59.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":11},"url":"https://github.com/1351/python-docx/issues/1351"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4266e4b2-c44c-d1a8-852e-11adfc841605 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9972:16695D:11B1E92:18AA073:696F4104 |
| html-safe-nonce | 9246581d382f33f56efcd17f20efc56defd7454a2e070acaba735bb4757143db |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OTcyOjE2Njk1RDoxMUIxRTkyOjE4QUEwNzM6Njk2RjQxMDQiLCJ2aXNpdG9yX2lkIjoiMzE4MTExMTU2MTU1NjAxNzQxMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6d834665ed420c6324f43b5cbbbd5a02e03f60b5007cc626e4abf35650e045d3 |
| hovercard-subject-tag | issue:2161614067 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-openxml/python-docx/1351/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4138ee643ce0170977a57b817130e0ff003dac2e6b25a993b304f88a2bdf0f92/python-openxml/python-docx/issues/1351 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4138ee643ce0170977a57b817130e0ff003dac2e6b25a993b304f88a2bdf0f92/python-openxml/python-docx/issues/1351 |
| og:image:alt | Hello Team we are using below code to load the document from docx import Document # Path to your DOCX file docx_file_path = 'myfile.docx' # Load the DOCX file document = Document(docx_file_path) # ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | akash97715 |
| hostname | github.com |
| expected-hostname | github.com |
| None | b278ad162d35332b6de714dfb005de04386c4d92df6475522bef910f491a35ee |
| turbo-cache-control | no-preview |
| go-import | github.com/python-openxml/python-docx git https://github.com/python-openxml/python-docx.git |
| octolytics-dimension-user_id | 3403760 |
| octolytics-dimension-user_login | python-openxml |
| octolytics-dimension-repository_id | 13592924 |
| octolytics-dimension-repository_nwo | python-openxml/python-docx |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 13592924 |
| octolytics-dimension-repository_network_root_nwo | python-openxml/python-docx |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 39aed5006635ab6f45e6b77d23e73b08a00272a3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width