Importing docx
question im using windmill web IDE and im importing Document from docx like so:
from docx import Document
but i get an error:
ExecutionErr: ExitCode: 1, last log lines:
ine 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/tmp/windmill/wk-default-7c4b588bcc40-N8AmH/01957f5e-1bdb-5979-73ce-9870d33c4812/wrapper.py", line 10, in <module>
from f.Devon.lcm import step_2 as inner_script
File "/tmp/windmill/wk-default-7c4b588bcc40-N8AmH/01957f5e-1bdb-5979-73ce-9870d33c4812/f/Devon/lcm/step_2.py", line 3, in <module>
from docx import Document
File "/tmp/windmill/cache/python_311/docx==0.2.4/docx.py", line 30, in <module>
from exceptions import PendingDeprecationWarning
ModuleNotFoundError: No module named 'exceptions'
problem is the docx is outdated but the guide tells me that windmill uses the newest version any fix for this or what i can do to work around this?
11 Replies
you likely need manual pinning: https://www.windmill.dev/docs/advanced/dependencies_in_python#pinning-dependencies-and-requirements
Dependencies in Python | Windmill
In Windmill standard mode, dependencies in Python are handled directly within their scripts without the need to manage separate dependency files.
requirements:
docx>=0.8.11
import wmill
from docx import Document
like this?
you will need to ping all requirements
but yes
(so wmill too)
maybe a dumb question but im an intern and windmill is new for me where can i see what version of windmill we are running?
I believe not. The library you are trying to pin (https://pypi.org/project/docx/) is not maintained since 2014 and been moved to another project. The more up-to-date version would be https://pypi.org/project/python-docx/
in the example it still says: from docx import Document
The thing is i cant do pip install from the web IDE
yes, both docx and python-docx have the same module called docx that you can import.
python-docx is newer project and I believe naming was chosen for better compatibility for people who migrate from docx to python-docx.
Just try this:
I think that works as now its complaining about my import wmill line
Please read the docs and try to understand what
#requirements:
doesIt works, thanks for helping me.