Skip to content

Commit

Permalink
This should resolve problems with older python versions
Browse files Browse the repository at this point in the history
  • Loading branch information
ArekKuczynski committed Dec 4, 2024
1 parent 61f542d commit 4ec0bb7
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions Tests/Regression/Reporter/read_docx.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def extract_images_from_run(run, heading, output_folder):
for rel in run.element.xpath('.//a:blip/@r:embed'):
part = doc.part.related_parts[rel]

image_name = f"{heading.replace(" ", "_")}_{image_counter}_image.png"
image_name = f"{heading.replace(' ', '_')}_{image_counter}_image.png"
image_path = os.path.join(output_folder, image_name)

with open(image_path, 'wb') as img_file:
Expand Down Expand Up @@ -201,10 +201,8 @@ def read_docx_file(docx_path: str, debug=False) -> dict:

elif paragraph.text.strip():
if current_heading_name:
print(paragraph.text.strip())
doc_data[current_heading_name]["text"].append(paragraph.text.strip())
else:
print(paragraph.text.strip())
doc_data.setdefault("Cover", {"text": []})
doc_data["Cover"]["text"].append(paragraph.text.strip())

Expand Down

0 comments on commit 4ec0bb7

Please sign in to comment.