Skip to content
← Back to Community
Python - Word Document with docx
Profile icon
TobiasWagner

Hello there,
I tried to use the Library docx together with the given example. But I just get the following error:

Traceback (most recent call last):
File "python", line 1, in
ModuleNotFoundError: No module named 'exceptions'

What is missing to be able to use the Library? Or is there another way to create Word Documents in Python which also works in repl.it?

Reference: https://python-docx.readthedocs.io/en/latest/

Thanks for your Help!
Greetings,
Lord Tkay

Answered by PYer [earned 5 cycles]
View Answer
Voters
Profile icon
TobiasWagner
Comments
hotnewtop
Profile icon
PYer

Just a question, why did you say "Greetings, Lord Tkay"?

Profile icon
pyelias

Add a requirements.txt file, and put python-docx in it, along with any other external libraries you need.

Profile icon
apraveena

@pyelias Hi, I am trying to access docx file from python also. Can you clarify what you mean by "put python-docx in it". I created a new text file in repl, not sure what to do next. https://repl.it/@apraveena/accessdocs#requirements.txt

Profile icon
MiquelAlguersua

polla

Profile icon
Puente

You can try installing docx in the shell:
pip install python-docx

Profile icon
21natzil

Can we see your repl @TobiasWagner ?