I'm working sap automatization(I use anaconda) and at the end of my code I use Jpype and aspose to make my excel read only password protected file.
import jpype
import asposecells
jpype.startJVM()
from asposecells.api import Workbook
timestamp = datetime.now().strftime("%Y%m%d%H%M")
workbook = Workbook("G:\\t.xlsx")
workbook.getSettings().getWriteProtection().setPassword("1234")
workbook.getSettings().getWriteProtection().setAuthor("asd");
workbook.save("G:/p_out " + timestamp + ".xlsx")
jpype.shutdownJVM()
I would like to create a exe file and did it also but this part of code the app shutdown with this error:
Traceback (most recent call last):
File "org.jpype.JPypeContext.java", line -1, in org.jpype.JPypeContext.callMethod Exception: Java Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "jpype\imports.py", line 195, in find_spec
java.lang.java.lang.ClassNotFoundException: java.lang.ClassNotFoundException: com.aspose
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "example.py", line 270, in <module>
File "PyInstaller\loader\pyimod02_importers.py", line 385, in exec_module
File "asposecells\api.py", line 10, in <module>
File "jpype\imports.py", line 203, in find_spec
ImportError: Failed to import 'com.aspose'
[18204] Failed to execute script 'example' due to unhandled exception!
I put .jar files into the folder, and supplement the .spec file.
I'm beginner in coding, thanks all help