essi
essi

Reputation: 3

install wand on a windows machine

I tried to install wand 0.4.4 on a windows 7 (64 bit).

I installed imagemagick binary (ImageMagick-6.9.3-1-Q16-x64-dll.exe). Then set MAGICK_HOME environment variable to the path of ImageMagick. Finally, I installed wand through pip in Anaconda (python 2.7.13).

When I run 'from wand.image import Image' I get the following error:

    ----> 2 from wand.image import Image
  3 # from PIL import Image as PI
  D:\Anaconda2\lib\site-packages\wand\image.py in <module>()
 18 
 19 from . import compat
 ---> 20 from .api import MagickPixelPacket, libc, libmagick, library
 21 from .color import Color
 22 from .compat import (binary, binary_type, encode_filename, file_types,
D:\Anaconda2\lib\site-packages\wand\api.pyc in <module>()
178 
179 try:
--> 180     libraries = load_library()
181 except (OSError, IOError):
182     msg = 'http://docs.wand-py.org/en/latest/guide/install.html'
D:\Anaconda2\lib\site-packages\wand\api.pyc in load_library()
124         try:
125             tried_paths.append(libwand_path)
--> 126             libwand = ctypes.CDLL(libwand_path)
127             if libwand_path == libmagick_path:
128                 libmagick = libwand
D:\Anaconda2\lib\ctypes\__init__.pyc in __init__(self, name, mode, handle,      use_errno, use_last_error)
360 
361         if handle is None:
--> 362             self._handle = _dlopen(self._name, mode)
363         else:
364             self._handle = handle
TypeError: LoadLibrary() argument 1 must be string, not unicode

What's going wrong?

Upvotes: 0

Views: 2058

Answers (2)

aritstack
aritstack

Reputation: 93

This is a Python 2.7.13 issue that will be closed with 2.7.14 release, which should come out around mid-2017; before this date you can use the fix suggested by emcconville directly editing the loading of native libraries for each required package or downgrade to Python 2.7.12.

Issue details and settlement patch on:

https://hg.python.org/cpython/rev/4ce22d69e134

Upvotes: 0

emcconville
emcconville

Reputation: 24439

What's going wrong?

This has been reported here. It'll most likely be fixed in the near-future.

The fix is to update two lines in api.py.

  1. Locate file wand/api.py file.
  2. Search for methods ctypes.CDLL called under load_library function.
  3. Cast unicode variables to strings.
    1. Change ctypes.CDLL(libwand_path) to ctypes.CDLL(str(libwand_path))
    2. Change ctypes.CDLL(libmagick_path) to ctypes.CDLL(str(libmagick_path))

Upvotes: 4

Related Questions