0

wand 0.6.11 running in the context of squish with python 3.8 seems to require 2 constructor arguments. Which arguments?

I want to use wand.image to compare the result of an image export function of a different tool. I've imported wand 0.6.11 for python, and tried it with success on the command line, with python 3.8 and 3.10, that I have available. In the terminal, I successfully call this, to convert a PDF to PNG:

from wand.image import Image

with Image(filename="testfile.pdf") as img:
    ...

But when executed in the context of the test framework squish, where I also use a python 3.8 interpreter, which has imported version 0.6.11 of wand, calling the same snippet raises this exception:

RuntimeError: The Image() constructor takes at least two arguments

I have tried adding several more arguments, e.g. like this:

Image(filename="testfile.pdf", format='pdf', 
      background="white", resolution=150, colorspace="srgb")

... but continue to get the same RuntimeError.

I tried to read the wand source for the Image constructor on github, but didn't manage to resolve my issue. What puzzles me is, why the same module would behave differently within the squish framework and on the commandline.

Does anyone here understand how I can get this right?

  • 1
    Please try importing the module and then wand.image.Image. – frog.ca May 25 '23 at 20:06
  • Of course, thanks! There must be two `Image` modules in my project now, and I get the wrong one. I tried changing to ``` from wand.image import Image as WImage ``` used that, and this fixes the issue. Problem solved :) – Aril Spetalen May 26 '23 at 06:30
  • 1
    And today I found this question, about an almost equal situation, where it is also explained: https://stackoverflow.com/questions/39137214 – Aril Spetalen May 26 '23 at 06:37

0 Answers0