Closed iconberg closed 9 years ago
Seems the error is raised when it tries decoding ImageMagick’s internal error message string (that is bytestring). I wonder how the bytestring is encoded.
Anyway here’s a workaround:
diff --git a/wand/resource.py b/wand/resource.py
index 6648bba..609a389 100644
--- a/wand/resource.py
+++ b/wand/resource.py
@@ -210,7 +210,7 @@ class Resource(object):
exc_cls = TYPE_MAP[severity.value]
message = desc.value
if not isinstance(message, string_type):
- message = message.decode()
+ message = message.decode(errors='replace')
return exc_cls(message)
def raise_exception(self, stacklevel=1):
Thx, i tracked it down to message.decode() but had no clue to hande it. Got 4Gbyte pictures today to convert, you saved my day :)
Unfortunaly the workaround didnt work as expected:
Traceback (most recent call last):
File "C:\Python34\media_sizes.py", line 49, in <module>
convert()
File "C:\Python34\media_sizes.py", line 30, in convert
with imgw.Image(filename=fp) as img:
File "C:\Python34\lib\site-packages\wand\image.py", line 1991, in __init__
self.read(filename=filename, resolution=resolution)
File "C:\Python34\lib\site-packages\wand\image.py", line 2048, in read
self.raise_exception()
File "C:\Python34\lib\site-packages\wand\resource.py", line 223, in raise_exception
raise e
wand.exceptions.BlobError: unable to open image `C:\Temp\media\original\W�ste.jpg': No such file or directory @ error/blob.c/OpenBlob/2701
As workaround i run a script that makes renaming before and after.
Hello,
i have following script that converts pictures in the "original" folder to two other folders with different sizes. Unfortanly i get "UnicodeDecodeError" for a lot of files. I use python34 and wand 0.3.9.
Here is my code:
Here is the traceback for a file named "wüste.jpg":
Is there a quick workaround for that?