Title: add_picture · Issue #187 · python-openxml/python-docx · GitHub
Open Graph Title: add_picture · Issue #187 · python-openxml/python-docx
X Title: add_picture · Issue #187 · python-openxml/python-docx
Description: I am new to python and I am having issues witth add_picture my code is simple from docx import Document from docx.shared import Inches document = Document() document.add_heading('Document Title', 0) document.add_picture('IMG_2063.jpg') d...
Open Graph Description: I am new to python and I am having issues witth add_picture my code is simple from docx import Document from docx.shared import Inches document = Document() document.add_heading('Document Title', 0...
X Description: I am new to python and I am having issues witth add_picture my code is simple from docx import Document from docx.shared import Inches document = Document() document.add_heading('Document Title...
Opengraph URL: https://github.com/python-openxml/python-docx/issues/187
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"add_picture","articleBody":"I am new to python and I am having issues witth add_picture\nmy code is simple \n\nfrom docx import Document\nfrom docx.shared import Inches\ndocument = Document()\ndocument.add_heading('Document Title', 0)\ndocument.add_picture('IMG_2063.jpg')\ndocument.add_page_break()\ndocument.save('demo.docx')\n\nfor some reason it was working and now i get a long string of errors. i cant seem to see what i am doing wrong. if nothting do i need to reinstall?\n\nhere is the error\nE:\\calculations\\temp\u003edoc2.py\nTraceback (most recent call last):\n File \"E:\\calculations\\temp\\doc2.py\", line 18, in \u003cmodule\u003e\n document.add_picture('IMG_2063.jpg')\n File \"C:\\Python27\\ArcGISx6410.2\\lib\\site-packages\\docx\\document.py\", line 79, in add_picture\n return run.add_picture(image_path_or_stream, width, height)\n File \"C:\\Python27\\ArcGISx6410.2\\lib\\site-packages\\docx\\text\\run.py\", line 62, in add_picture\n inline = self.part.new_pic_inline(image_path_or_stream, width, height)\n File \"C:\\Python27\\ArcGISx6410.2\\lib\\site-packages\\docx\\parts\\document.py\", line 91, in new_pic_inline\n rId, image = self.get_or_add_image(image_descriptor)\n File \"C:\\Python27\\ArcGISx6410.2\\lib\\site-packages\\docx\\parts\\document.py\", line 54, in get_or_add_image\n image_descriptor\n File \"C:\\Python27\\ArcGISx6410.2\\lib\\site-packages\\docx\\package.py\", line 76, in get_or_add_image_part\n image = Image.from_file(image_descriptor)\n File \"C:\\Python27\\ArcGISx6410.2\\lib\\site-packages\\docx\\image\\image.py\", line 55, in from_file\n return cls._from_stream(stream, blob, filename)\n File \"C:\\Python27\\ArcGISx6410.2\\lib\\site-packages\\docx\\image\\image.py\", line 176, in _from_stream\n image_header = _ImageHeaderFactory(stream)\n File \"C:\\Python27\\ArcGISx6410.2\\lib\\site-packages\\docx\\image\\image.py\", line 198, in _ImageHeaderFactory\n return cls.from_stream(stream)\n File \"C:\\Python27\\ArcGISx6410.2\\lib\\site-packages\\docx\\image\\jpeg.py\", line 47, in from_stream\n markers = _JfifMarkers.from_stream(stream)\n File \"C:\\Python27\\ArcGISx6410.2\\lib\\site-packages\\docx\\image\\jpeg.py\", line 111, in from_stream\n for marker in marker_parser.iter_markers():\n File \"C:\\Python27\\ArcGISx6410.2\\lib\\site-packages\\docx\\image\\jpeg.py\", line 177, in iter_markers\n marker_code, self._stream, segment_offset\n File \"C:\\Python27\\ArcGISx6410.2\\lib\\site-packages\\docx\\image\\jpeg.py\", line 271, in _MarkerFactory\n return marker_cls.from_stream(stream, marker_code, offset)\n File \"C:\\Python27\\ArcGISx6410.2\\lib\\site-packages\\docx\\image\\jpeg.py\", line 413, in from_stream\n tiff = cls._tiff_from_exif_segment(stream, offset, segment_length)\n File \"C:\\Python27\\ArcGISx6410.2\\lib\\site-packages\\docx\\image\\jpeg.py\", line 455, in _tiff_from_exif_segment\n return Tiff.from_stream(substream)\n File \"C:\\Python27\\ArcGISx6410.2\\lib\\site-packages\\docx\\image\\tiff.py\", line 36, in from_stream\n parser = _TiffParser.parse(stream)\n File \"C:\\Python27\\ArcGISx6410.2\\lib\\site-packages\\docx\\image\\tiff.py\", line 63, in parse\n ifd_entries = _IfdEntries.from_stream(stream_rdr, ifd0_offset)\n File \"C:\\Python27\\ArcGISx6410.2\\lib\\site-packages\\docx\\image\\tiff.py\", line 176, in from_stream\n entries = dict((e.tag, e.value) for e in ifd_parser.iter_entries())\n File \"C:\\Python27\\ArcGISx6410.2\\lib\\site-packages\\docx\\image\\tiff.py\", line 176, in \u003cgenexpr\u003e\n entries = dict((e.tag, e.value) for e in ifd_parser.iter_entries())\n File \"C:\\Python27\\ArcGISx6410.2\\lib\\site-packages\\docx\\image\\tiff.py\", line 204, in iter_entries\n ifd_entry = _IfdEntryFactory(self._stream_rdr, dir_entry_offset)\n File \"C:\\Python27\\ArcGISx6410.2\\lib\\site-packages\\docx\\image\\tiff.py\", line 231, in _IfdEntryFactory\n return entry_cls.from_stream(stream_rdr, offset)\n File \"C:\\Python27\\ArcGISx6410.2\\lib\\site-packages\\docx\\image\\tiff.py\", line 256, in from_stream\n stream_rdr, offset, value_count, value_offset\n File \"C:\\Python27\\ArcGISx6410.2\\lib\\site-packages\\docx\\image\\tiff.py\", line 294, in _parse_value\n return stream_rdr.read_str(value_count-1, value_offset)\n File \"C:\\Python27\\ArcGISx6410.2\\lib\\site-packages\\docx\\image\\helpers.py\", line 70, in read_str\n chars = self._unpack_item(struct, base, offset)\n File \"C:\\Python27\\ArcGISx6410.2\\lib\\site-packages\\docx\\image\\helpers.py\", line 96, in _unpack_item\n bytes_ = self._read_bytes(struct.size, base, offset)\n File \"C:\\Python27\\ArcGISx6410.2\\lib\\site-packages\\docx\\image\\helpers.py\", line 88, in _read_bytes\n raise UnexpectedEndOfFileError\ndocx.image.exceptions.UnexpectedEndOfFileError\n","author":{"url":"https://github.com/davelawrence3d","@type":"Person","name":"davelawrence3d"},"datePublished":"2015-06-15T19:43:10.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":14},"url":"https://github.com/187/python-docx/issues/187"}
| 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:211f3d6f-2602-3978-1502-0957925ae732 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8010:1F8597:17BD003:2010AB6:6972B11B |
| html-safe-nonce | 157b575ffa0db939edbbaefa2898b038b9fb5f5d8269899c481f7f010b1030b5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MDEwOjFGODU5NzoxN0JEMDAzOjIwMTBBQjY6Njk3MkIxMUIiLCJ2aXNpdG9yX2lkIjoiNjUwODk4NjM2MTY1Nzg3OTMyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d9f9d57f3702aafaf2d391f9c93a16918846302521bfd77ecdbdaf88bd82150c |
| hovercard-subject-tag | issue:88520648 |
| 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/187/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bb398d204923ad9a59948f480f3c5d9a23b7168365c93f8a8f0effb2baa5e1b5/python-openxml/python-docx/issues/187 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bb398d204923ad9a59948f480f3c5d9a23b7168365c93f8a8f0effb2baa5e1b5/python-openxml/python-docx/issues/187 |
| og:image:alt | I am new to python and I am having issues witth add_picture my code is simple from docx import Document from docx.shared import Inches document = Document() document.add_heading('Document Title', 0... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | davelawrence3d |
| hostname | github.com |
| expected-hostname | github.com |
| None | ae357919e9cc5fb635a01c9a2cc530478d3ac85f55090215eb70e1beca3385ac |
| 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 | 625f1bd9f76a617a9c0729e2de91edb56b6ce42f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width