Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Fri Feb 09, 2024 5:59 pm

Hi,
is it possible to use pyinstaller to generate an executable that can be distributed including Spire.Doc for Python ?
Thanks

mbertol4
 
Posts: 6
Joined: Fri Feb 09, 2024 5:23 pm

Mon Feb 12, 2024 6:01 am

Hi,

Thanks for your inquiry.
Due to February 8 to February 17 is our Spring Festival, we have a holiday, we currently don’t have test environment to test your scenario you mentioned. I suggest you can test this scenario, if there are any issues, just write back. Sorry for the inconvenience caused.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 984
Joined: Tue Mar 08, 2022 2:02 am

Thu Feb 15, 2024 8:44 am

Dear Team,

I have been working on generating an executable using PyInstaller for a Python script that utilizes Spire.Doc to convert DOC files to PDF. However, upon attempting to run the generated executable, I encountered an error.

Please find the error details attached for your reference.

I would appreciate any insights or suggestions you might have to resolve this issue.

Best regards.

Traceback (most recent call last):
File "conv_docx_pdf_par.py", line 34, in <module>
File "conv_docx_pdf_par.py", line 7, in convert_docx_to_pdf
File "plum/function.py", line 642, in __call__
File "plum/function.py", line 592, in __call__
File "spire/doc/Document.py", line 95, in __init__
AttributeError: 'NoneType' object has no attribute 'Document_CreateDocumentF'
[1108361] Failed to execute script 'conv_docx_pdf_par' due to unhandled exception!
Exception ignored in: <function SpireObject.__del__ at 0x7facae501310>
Traceback (most recent call last):
File "spire/doc/common/SpireObject.py", line 30, in __del__
AttributeError: 'NoneType' object has no attribute 'Spire_FreeHandle'


as a general question, what is the proper way to generate executable from programs referencing your tool ?

Thanks

KR

mbertol4
 
Posts: 6
Joined: Fri Feb 09, 2024 5:23 pm

Fri Feb 16, 2024 8:28 am

Hello,

Thank you for your feedback.
Based on your description, I'm sorry I don't quite understand your execution steps. Please provide the detailed execution steps along with the action code so that we can investigate your issue quickly and efficiently. You could attach them here or send them to us via email (support@e-iceblue.com). Thanks in advance.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1651
Joined: Wed Apr 07, 2021 2:50 am

Sat Feb 17, 2024 6:00 am

Dear Team,

To provide some clarity on my request, I have developed a Python script that successfully converts DOC files to PDF using the Spire.Doc library. My goal is to compile this script into a redistributable Linux executable.

I attempted to create the executable using PyInstaller, but encountered an error when trying to run the generated executable. The error message was attached in my previous correspondence.

My question is: How can I compile and redistribute a Python script that utilizes the Spire.Doc library?

Thank you for your assistance.

Kind Regards,

Marco

mbertol4
 
Posts: 6
Joined: Fri Feb 09, 2024 5:23 pm

Sun Feb 18, 2024 9:58 am

Hi,

Thanks for your reply.
I reproduced your issue after doing init test. To help us do further investigation and fix accurately your issue, please offer the following message:
1) The linux version, such as Centos 7.6.
2) The complete executable file, you can send it via email(support@e-iceblue.com)

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 984
Joined: Tue Mar 08, 2022 2:02 am

Fri Feb 23, 2024 5:49 am

Hi,
system is a Red Hat Enterprise Linux release 8.9 (Ootpa) Python 3.9.12

thanks

KR

mbertol4
 
Posts: 6
Joined: Fri Feb 09, 2024 5:23 pm

Fri Feb 23, 2024 7:16 am

Hi,

Thanks for your feedback.
For your issue, according to the feedback from our Dev team, you need to add Spire.Doc.Base.so and libSkiaSharp.so to executable file when using pyinstaller, and Spire.Doc.Base.so and libSkiaSharp.so exist in the installed folder of Spire.Doc, as shown in the following picture.
08A9D5E5-C3C3-4cc3-85E4-94391D4A550C.png

I put my test code below for your reference, you need to change the path of Spire.Doc.Base.so and libSkiaSharp.so.
Code: Select all
pyinstaller --add-binary /LinuxCases/Spire.Doc.Base.so:./spire/doc/lib --add-binary /LinuxCases/libSkiaSharp.so:./spire/doc/lib toPdf.py


Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 984
Joined: Tue Mar 08, 2022 2:02 am

Fri Feb 23, 2024 5:17 pm

Thanks, that worked perfectly.

mbertol4
 
Posts: 6
Joined: Fri Feb 09, 2024 5:23 pm

Mon Feb 26, 2024 1:21 am

Hi,

Thanks for your feedback.
If you have any issue in the future, just write back.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 984
Joined: Tue Mar 08, 2022 2:02 am

Return to Spire.Doc

cron