Free Support Forum - aspose.com

Cannot get license to work

Hi,

Because of the memory leak I’m facing with RJB and Aspose in Ruby I’m trying again in python.
I have an issue with setting the licence.
I tried with :

licenseStr = "lib/aspose/license.lic"
licensePath = jpype.java.lang.String("lib/aspose/license.lic")
licenseStream = jpype.java.io.FileInputStream("lib/aspose/license.lic")

asposeLicense = jpype.JClass('com.aspose.slides.License')
asposeLicense.setLicense(licenceStr)

Also tried with asposeLicense.setLicense(licenceStream) or asposeLicense.setLicense(licencePath)

But I’m getting this type of error :

TypeError: No matching overloads found for com.aspose.slides.License.setLicense(java.lang.String), options are:
	public void com.aspose.slides.License.setLicense(java.lang.String) throws com.aspose.slides.AsposeLicenseException
	public void com.aspose.slides.License.setLicense(java.io.InputStream) throws com.aspose.slides.AsposeLicenseException

This is very confusing as it seems to get what it’s expecting.
I’m using Python 3.7 and am not ready to downgrade to 2.7

So my question : how do I set the license ?

Thanks

@albandum

You may please try using following:

asposeLicense = jpype.JClass('com.aspose.slides.License')()

instead of

asposeLicense = jpype.JClass('com.aspose.slides.License')

Perfect thanks