Aspose-cells Python via Java Workbook _init__() takes exactly one argument

We are encountering an Exception loading an existing XLSX file into a Workbook. We are following the guidance on this page Different Ways to Open Files|Documentation (aspose.com)](Different Ways to Open Files|Documentation)
from java_client import java_client # starting java, not relevant for this question
from jpype import java
java_client.install_jre()
import jpype
import asposecells
java_client.start_jvm()
from asposecells.api import *
fis = java.io.FileInputStream(“template.xlsx”) # Error raised - below
logging.info(“file read”)
workbook = Workbook(fis)

Exception:
Exception: TypeError: object.init() takes exactly one argument (the instance to initialize)

line 47, in test_function workbook = Workbook(fis) File “/home/site/wwwroot/.python_packages/lib/site-packages/asposecells/api.py”, line 2992, in init super(Workbook, self).init(*args)

Platform: Debian
Python 3.9

@vdimov,

Which version of the API (Aspose.Cells for Python via Java) you are using? Also, provide complete environment details. Does the issue occur only with specific Excel file or for all Excel files?

Packages:

  • aspose-cells-20.2.0
  • install-jdk-0.3.0
  • jpype1-1.4.1
  • packaging-23.0

File:

Exception:
workbook = Workbook(fis) File “/home/site/wwwroot/.python_packages/lib/site-packages/asposecells/api.py”, line 2992, in init super(Workbook, self).init(*args)

@vdimov,
Would you like to test again with Aspose-cells Python via Java 23.1? We can get the right result. The following is the test code, please check.

import jpype
from jpype import java
import asposecells
jpype.startJVM()
from asposecells.api import Workbook, SaveFormat
fis = java.io.FileInputStream(“template_simple.xlsx”)
workbook = Workbook(fis)
workbook.save(“template_simple_out.xlsx”)
jpype.shutdownJVM()

@vdimov
I think the exception may have something to do with the java_client you use. Aspose.Cells for Python via Java only supports Jdk1.8 or higher, please refer to Getting Started|Documentation