-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
from matplotlib import animation UnicodeDecodeError #14902
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Might be related #3837 Possibly you will get more information with
|
Not sure this error makes any sense regardless, but do you have imagemagick installed? |
This error stops animation from being import'd. My log does not show imagemagick being installed. Must have either come with the system or some other package required it. |
In order to run an animation we call outside packages. You need imagemagick if you use the imagemagick movie writer OTOH this error probably shouldn’t happen. Ping @antzer who I think did some work on this recently |
Here is a pretty similar issue, https://stackoverflow.com/questions/57115893, though with a different error. Clearly, the problem is that matplotlib/lib/matplotlib/animation.py Line 728 in 8d3e817
only checks for some "executable not found", but not for other errors that could happen along the way. |
I see the problem, but, not how to fix it.
In determining the ImageMagick version, I think matplotlib executes
'convert --version'
convert --version
Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jpeg
lcms lqr ltdl lzma openexr pangocairo png tiff wmf x xml zlib
Notice the Copyright sign, after the word Copyright.
This is what codecs pukes on.
I have sys.getdefaultencoding() returns utf-8.
|
This makes this issue two-fold:
|
This patch makes it work. Don't know what other things it may break...
*** /usr/lib/python3.6/encodings/ascii.py.orig Sat Jul 27 14:57:32 2019
--- /usr/lib/python3.6/encodings/ascii.py Sat Jul 27 15:04:34 2019
***************
*** 23,28 ****
--- 23,30 ----
class IncrementalDecoder(codecs.IncrementalDecoder):
def decode(self, input, final=False):
+ nonascii = bytearray(range(0x80, 0x100))
+ input = input.translate(None, nonascii)
return codecs.ascii_decode(input, self.errors)[0]
class StreamWriter(Codec,codecs.StreamWriter):
|
I guess something like diff --git i/lib/matplotlib/__init__.py w/lib/matplotlib/__init__.py
index 8103bc3d6..99b24483e 100644
--- i/lib/matplotlib/__init__.py
+++ w/lib/matplotlib/__init__.py
@@ -330,7 +330,8 @@ def _get_executable_info(name):
# at least min_ver (if set); else, raise ExecutableNotFoundError.
try:
output = subprocess.check_output(
- args, stderr=subprocess.STDOUT, universal_newlines=True)
+ args, stderr=subprocess.STDOUT,
+ universal_newlines=True, errors="replace")
except subprocess.CalledProcessError as _cpe:
if ignore_exit_code:
output = _cpe.output would work? |
That seems to have fixed it on my machine. Possibly a better fix,
higher in the process change and a less intrusive change.
|
Bug report
Bug summary
In interactive python3 'from matplotlib import animation' causes an error.
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 87: ordinal not in range(128)
Code for reproduction
Actual outcome
Expected outcome
matplotlib.animation would be imported.
I am not sure it ever worked.
Matplotlib version
print(matplotlib.get_backend())
): GTK3AggPython3 came with the distribution and was updated with apt
matplotlib was installed with python3 -m pip install matplotlib. Updated with pip.
The text was updated successfully, but these errors were encountered: