Hi,
When running my script in Aspose Words Python 24.12 & 25.1 I get an error.
It has worked with all versions I’ve used before, starting with 22.12.
This is the message I get:
"Unhandled exception. System.IO.FileLoadException: Could not load file or assembly ‘System.Text.Encoding.CodePages, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’. The located assembly’s manifest definition does not match the assembly reference. (0x80131040)
File name: ‘System.Text.Encoding.CodePages, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’
Fatal error. Internal CLR error. (0x80131506)
at Aspose.WrpGen.Interop.ExchangeHost.InitServices()
Aborted (core dumped)".
Any idea what can be wrong?
I’m using Ubuntu 20.04.
Best regards
Robert
Hi,
I tried removing everything but ‘import aspose.words as aw’ and still get the error.
Something seem really wrong.
@RobertJansson I have tested on my side with the following simple script:
import sys
import io
import aspose.words as aw
lic = aw.License()
lic.set_license("/temp/Aspose.Total.Python.NET.lic")
doc = aw.Document("/temp/in.docx")
doc.save("/temp/out.pdf")
and the following Dockerfile:
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND="noninteractive"
RUN apt-get update -y
RUN apt-get install -y python3
RUN apt-get install -y python3-pip
RUN apt-get install -y pkg-config libicu-dev
WORKDIR /usr/app/src
# Copy function code
COPY app.py ./
RUN pip install aspose-words
ENTRYPOINT ["python3", "app.py"]
Everything works as expected on my side. Could you please provide more information about your environment? We will try to reproduce it in Docker and test your scenario.
It’s Ubuntu 20.04 and Python 3.8.10.
I just tried Python 9.5 and get a different error.
Now it’s just "ModuleNotFoundError: No Module named ‘aspose’ ".
It’s strange because nothing else has changed. I just upgraded the Aspose version.
Any specific info about the environment you need?
I should add that going back to Aspose version 24.11 everything works like before.
But with 24.12 and 25.1 I have this problem.
@RobertJansson Thank you for additional information. Unfortunately, we cannot reproduce the problem on our side. We have tested on different Linux OS and everything works as expected. If possible, could you please create a Dockerfile that emulates your environment where the problem occurs?
Ok, thanks.
I don’t use Docker and wouldn’t know how to emulate my system.
Strange thing though is if I go back to Aspose 24.11 and use Python 3.8.10 it works.
If I use Python 3.9.5 (with 24.11) it can’t find a module named ‘aspsose’.
There must be a dependency I’m not aware of.
I will try to setup a fresh Ubuntu 20.04 VM to see if that works better.
@RobertJansson As I can see Aspose.Words for Python requires Python version >=3.6,<3.14. So it must work fine with Python 3.9.5. I tested with different versions on my side and everything works as expected. You can see the addition modules installed in my test environment in the Dockerfile I have provide above.