File "com.aspose.cells.a.a.v5.java", line -1, in com.aspose.cells.a.a.v5.<clinit>

Hello Everyone,
I have been using the Aspose.cells Python library and facing the below issue from Library version 22.1.0 to 23.7.0.

in my Local environemnt try 22.1.0 to 23.7.0, getting same issue. Java version configured in my system is C:\Program Files\Java\jdk1.8.0_341 (windows)

Linux ->
$ java -version
java version “1.8.0_251”

Python Source:
from asposecells.api import Workbook
workbook = Workbook("./excel_sample.xlsx")
workbook.save("./excel_sample.txt")

from asposecells.api import Workbook
workbook = Workbook("./excel_sample.xlsx")
Traceback (most recent call last):
File “com.aspose.cells.a.a.v5.java”, line -1, in com.aspose.cells.a.a.v5.
java.lang.NullPointerException: java.lang.NullPointerException

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “com.aspose.cells.Workbook.java”, line -1, in com.aspose.cells.Workbook.
File “com.aspose.cells.Workbook.java”, line -1, in com.aspose.cells.Workbook.a
File “com.aspose.cells.i0v.java”, line -1, in com.aspose.cells.i0v.a
File “com.aspose.cells.i0v.java”, line -1, in com.aspose.cells.i0v.a
File “com.aspose.cells.i0v.java”, line -1, in com.aspose.cells.i0v.a
File “com.aspose.cells.s9g.java”, line -1, in com.aspose.cells.s9g.
File “com.aspose.cells.s9g.java”, line -1, in com.aspose.cells.s9g.a
Exception: Java Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “”, line 1, in
java.lang.ExceptionInInitializerError: java.lang.ExceptionInInitializerError

workbook.save("./excel_sample.txt")

help me solve this issue.

@kathirmsc85,

Could you please zip and attach the file “excel_sample.xlsx” so that we can evaluate your issue on our end?

ReferenceDoclet_withSingleCell.zip (22 Bytes)

Please refer the attached sample file.

Thanks.

@kathirmsc85,
The compressed file you uploaded is only 22 Bytes, and there are no files in it. Would you like to recompress and upload it?

excel_sample.zip (7.7 KB)

Please find the attached fiel.

Thanks,

@kathirmsc85,
Would you like to use the latest version Aspose.Cells for Python via Java 23.7 for testing? Through the following code, we can obtain the correct result. Please refer to the attachment (8.1 KB).

The sample code as follows:

import jpype
from jpype import java
import asposecells
jpype.startJVM()
from asposecells.api import Workbook, CellsHelper

print(CellsHelper.getVersion())
workbook = Workbook("excel_sample.xlsx")
workbook.save("excel_sample.txt")
jpype.shutdownJVM()

Hope helps a bit.

@John.He Thank you so much, the issue is not added the import statement of the library.

> import asposecells

Now, able to read the excel files without issues.

But wondering, what is the difference between these to imports?
import asposecells & from asposecells.api import Workbook, CellsHelper,

Thanks

@kathirmsc85,
import asposecells:
This line of code is used to import the bridge module.
Aspose.Cells for Python via Java implements Python through Java. We also have the Aspose.Cells for Python via NET library.

from asposecells.api import Workbook, CellsHelper:
This line of code is used to import specific content from the asposecells.api module.

I am glad that your issue has been resolved. If you have any questions, please feel free to contact us.