Skip to content

Compatibility Issue with AI-Generated JSON and Python-docx #1476

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
181Michael opened this issue Mar 15, 2025 · 2 comments
Closed

Compatibility Issue with AI-Generated JSON and Python-docx #1476

181Michael opened this issue Mar 15, 2025 · 2 comments

Comments

@181Michael
Copy link

Description

AI-generated JSON files are causing parsing issues in Python-docx.
The issue seems to stem from recursive structures generated by the AI model, which causes Python-docx to misinterpret paragraph breaks and eventually fail during parsing.

Expected Outcome

  • JSON files should be processed without parsing conflicts.
  • Python-docx should be able to recognize paragraph markers correctly.

Actual Outcome

  • Python-docx crashes during parsing.
  • Paragraph markers are misaligned, causing the document structure to break.

Reproduction Steps

  1. Generate a JSON file using an AI model (e.g., GPT).
  2. Attempt to parse the JSON data using Python-docx.
  3. Observe that parsing fails due to misaligned paragraph markers.

Technical Environment

  • Python-docx Version: [Latest stable version]
  • Python Version: [3.x.x]
  • OS: [Windows/MacOS/Linux]

Additional Notes

  • This issue might be related to how AI-generated content structures recursive markers.
  • Fixing this could improve compatibility with AI-generated data.

Supporting Materials

(If you have a sample JSON file or error log, you can attach it here.)

@181Michael
Copy link
Author

Hello,
I’d like to clarify that I’m not a developer myself. With @chatgpt’s guidance, I raised this issue because I noticed unexpected behavior with GPT-generated JSON files in Python-docx.
I greatly appreciate any insights or solutions the developer community can provide. Thank you for your understanding! 🙏

@scanny
Copy link
Contributor

scanny commented Mar 15, 2025

Dude. I have no idea what you're talking about :)

python-docx doesn't have a JSON interface so I think maybe your AI tool is hallucinating or something. You need to do your research to work out how to use python-docx and how you might want to use it for the task at hand. There is not nearly enough to go on here and I strongly suspect you're just trying to use it in a way that violates the published interface.

I recommend starting with the documentation here: https://python-docx.readthedocs.io/en/latest/

Closing as not actionable.

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