Forum

Author Topic: Ms.Image.fromstring returns error  (Read 4872 times)

forumname

  • Newbie
  • *
  • Posts: 36
    • View Profile
Ms.Image.fromstring returns error
« on: November 20, 2023, 05:12:04 AM »
I have a numpy array I would like to import to Ms.Image. This code block has worked fine previously, possibly before upgrading to 2.0.

Code: [Select]
# image.dtype is dtype('uint8')
# image.shape is (800, 1280)
Ms.Image.fromstring(image, image.shape[1], image.shape[0], ' ', datatype='U8')

However, the first line returns the error,
Code: [Select]
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
Problem exists in 2.0.2 and 2.0.3.
« Last Edit: November 20, 2023, 05:34:41 AM by forumname »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15165
    • View Profile
Re: Ms.Image.fromstring returns error
« Reply #1 on: November 20, 2023, 04:48:41 PM »
Hello forumname,

Can you please specify, if you run this line via Metashape interface (Console pane or Run script dialog) or whether you are using stand-alone module (.whl)? In the latter case please specify the OS used and version of system Python.
Best regards,
Alexey Pasumansky,
Agisoft LLC

forumname

  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: Ms.Image.fromstring returns error
« Reply #2 on: November 20, 2023, 08:23:47 PM »
Thank you, Alexey.

Installed from whl in a custom conda environment with python 3.10.13. Ubuntu 23.04.

Possibly related to changes introduced in python 3.10.

I will try to downgrade my environment to <3.10.

EDIT: confirmed this operation works correctly on with python 3.7.12.
« Last Edit: November 21, 2023, 01:59:13 AM by forumname »