SetLicense doesn't work

I’m currently testing Aspose.PSD OEM and have a test license. However I’m unable to set the license and get killed when I try to import the license class:

Python version: 3.9.6 (default, Mar 29 2024, 10:51:09)
[Clang 15.0.0 (clang-1500.3.9.4)]
Attempting to import License class from aspose.psd…
zsh: killed python3 test_aspose.py

without import aspose.psd:

Python version: 3.9.6 (default, Mar 29 2024, 10:51:09)
[Clang 15.0.0 (clang-1500.3.9.4)]
Attempting to import aspose…
Successfully imported aspose
Aspose version: Unknown
Script completed.

With import aspose.psd:
Python version: 3.9.6 (default, Mar 29 2024, 10:51:09)
[Clang 15.0.0 (clang-1500.3.9.4)]
Attempting to import aspose…
Successfully imported aspose
Aspose version: Unknown
Aspose file location: /Users/jannikvogt/Library/Python/3.9/lib/python/site-packages/aspose/init.py
Aspose module contents:

  • AsposeModuleFinder
  • AsposeModuleLoader
  • SourceFileLoader
  • all
  • builtins
  • cached
  • doc
  • file
  • loader
  • name
  • package
  • path
  • spec
  • _load
  • _platform_suffixes
  • extension_suffixes
  • foreach_file
  • im
  • inspect
  • os
  • re
  • sys
  • sysconfig
  • util

Attempting to import aspose.psd…
zsh: killed python3 test_aspose.py

@dappmachin3 could you please provide additional information. Is license that you use is for Aspose.PSD for Python? Also, Aspose.PSD Product Family License should work fine too.

What’s version of Aspose.PSD for Python do you use? If it’s the latest version, could you please send to me the temporary license in DM.

I have send you a dm, thanks for the help.

@dappmachin3
Thank you, I’ve succesfully received the license. We’ll need some time to investigate issue, I’ll text you back in few days. At this moment we have opened the following new ticket(s) in our internal issue tracking system with high priority.
Usually we deliver fixes according to the terms mentioned in Free Support Policies. In this case, I’ll check this ASAP.

Issue ID(s): PSDPYTHON-92

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Ok thanks a lot. So there is an issue with the library? I thought I was doing something wrong. :sweat_smile:

@dappmachin3 we need to investigate it. And worknig on it.

@dappmachin3 License form PDF is broken, but it possible because the PDF formatting. Could you please compress to zip archive the TXT file with license and it to me too via DM. If the Issue with license will be confirmed, I’ll ask sales team to make new license.

Aspose.PSDforPythonvia.NET.lic.zip (1,4 KB)

@dappmachin3 I checked license. The file is correct and works fine on my side.
Please try the following:
Download last version of Aspose.PSD from Pypi or from https://releases.aspose.com/psd/python-net/ for you OS.

Then use the following to install Aspose.PSD:
python -m pip install “path\to\local\artifact\aspose_psd-24.7.0-py3-none-win_amd64.whl” (or for other version, for MAC or Linux)

Then try the following code:

#Import should look like this
from aspose.psd import License, Metered

license = License()
license.set_license("path\to\your\license\Aspose.PSDforPythonvia.NET.lic")

Could you please additionally provide what’s OS is used? Aspose.PSD has the versions for Win32, Win64, Linux, MacOS and MacOS Arm.

I’m using MacOS x64 Sonoma 14.6.1

I have tried this version:

Icons Aspose.PSD for Python via .NET 24.6.0 macOS 10.14 Mojave x86_64

Getting the same issue.

Okay I ran it now in the cloud on a aws instance with windows amd64 and it works. But I’m currently having the problem that it says “the file is no valid psd file”. It still does the job and saves the image, but if I run another script where it’s supposed to replace the smartobject it still will save an image but without replacing the smartobject. This is the script to simply save an image:

from aspose.psd import License, Image
from aspose.psd.fileformats.psd import PsdImage
from aspose.psd.imageoptions import PngOptions

Lizenz setzen

license = License()
license.set_license(“Aspose.PSDforPythonvia.NET.lic”)

Öffne eine PSD-Datei

psd_path = “iphone13snapcase.psd”
psd_image = PsdImage.load(psd_path)

Bearbeite die PSD-Datei (hier einfach nur die Größe ändern)

new_width = psd_image.width // 2
new_height = psd_image.height // 2
psd_image.resize(new_width, new_height)

Speichere die bearbeitete Datei als PNG

output_path = “edited_example.png”
png_options = PngOptions()
psd_image.save(output_path, png_options)

Überprüfen, ob eine close-Methode verfügbar ist

if hasattr(psd_image, ‘close’):
psd_image.close()

print(“Die bearbeitete PSD-Datei wurde als PNG gespeichert unter:”, output_path)

If we get this to work I’ll be you customer.

We checked minimal required code to apply license under macOS and all works fine. We checked with Python 3.7.2 and 3.9.6, was checked version Aspose.PSD 24.7. So, I think, we should search for issue in environment.

We made the following steps:

python3 -m pip install “aspose.psd”

Then created somefile.py file with minimal required code:

from aspose.psd import License, Metered

license = License()
license.set_license("path\to\your\license\Aspose.PSDforPythonvia.NET.lic")

and ran it with

python3 somefile.py

Could you please describe your requirement with the SmartObject Replacing in details.
Did you try replace the image in SmartObject or replace smart object with other layer? Both cases are supported by Aspose.PSD but each of them quite different in implementation.

This code for replacing the content of smart object

    with Image.load(sourceFile) as image:
        psdImage = cast(PsdImage, image)
        for layer in psdImage.layers:

            if is_assignable(layer, SmartObjectLayer) and layer.name == "sucai1":
                smartObjectLayer = cast(SmartObjectLayer, layer)
                smartObjectLayer.replace_contents(changeFile)
                smartObjectLayer.embed_linked()
                break

Full example can be found here: GitHub - aspose-psd/Aspose.PSD-for-Python-Net: Aspose.PSD for Python examples, plugins and showcases

If you need to replace one layer by another, please try to replace layer in PsdImage.layers[] property.