-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Animation.save leads to unicode decode error. #3837
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
Interesting, this is merely displaying output from the movie saver. What On Sun, Nov 23, 2014 at 6:20 AM, Till Stensitzki notifications@github.com
|
I put the executable in the same directory as the ipynb file, so it should be useable. |
what is the error message if the executable is not in the correct location? On Sun, Nov 23, 2014 at 9:10 AM, Till Stensitzki notifications@github.com
|
After puting the exe in a folder in sys.path, the everything works, so the error problay was that |
Strange that it would error out that way, though. There are checks early on On Sun, Nov 23, 2014 at 9:19 AM, Till Stensitzki notifications@github.com
|
On line 232 shown in the traceback, it looks like the problem is that |
Alternatively, all of the Popen initializations could be done with |
I don't think we want to use universal_newlines=True, because it applies to stdout and stderr at the same time, and I think stdout is being used here for a byte stream as well as for text. The simplest thing would be to make the decoding use the same codec as would occur with universal_newlines---except that it is actually version-dependent. (It at least changed between 3.3 and 3.4.) I suspect we should follow the python3.4 model, with |
I'm unable to reproduce the bug -- the mp4 writes correctly with both imagemagick & mencoder after I got all the incantations correct (agreed with the OP that the error messages are fairly daunting -- I've never done animations before). However, I'm on master with 32bit (win7) so it's not a direct comparison. I'm going to sleep on it. I can't really fathom though why we should be getting non-ascii output in stderr from any encoder. |
Hmm, well I guess the OP agrees that it works once one gets the path incantations correct so I guess this boils down to improving the error messages. The failure I'm getting is not at all like the OP's failure though:
|
@jbmohler, I suspect that if the OS locale is not an English language one, then the OS might return error messages with non-ascii characters in them. On Linux or OSX, I think these would be encoded in UTF-8, but I don't know what Windows does. The error is being returned via stderr as a byte string, and this should be explicitly decoded to unicode prior to being used in the formatted string, using a fail-safe option and a reasonable shot at the encoding. Same for stdout when it is being interpreted as text. As you say, the point here is not to solve the original problem, but to fix what I believe to be broken error reporting on 4 lines in animation.py, if I remember correctly. On a Windows machine, what do you get from import locale
print(locale.getpreferredencoding(False))
print(locale.getpreferredencoding(True)) I think what will be needed is import locale
_encoding = locale.getpreferredencoding(True) at the top, and then out = out.decode(_encoding, 'replace')
err = err.decode(_encoding, 'replace') prior to using them in error reporting. |
|
punting to 1.4.x, any protest? |
Seems like a pretty standalone fix, can we mark it as new-contributor-friendly? |
@Tillsten would you check to see whether the problem still exists, and if it does, then see whether my suggestion works, and if it works, then make a PR for it? Thank you. |
I also suspect that this will 'just work' in python3 |
Sorry, no Py2 avaible anymore :) |
I think this has almost certainly been fixed with the switch to logging and a bunch of fixes to animation logging on similar issues as well. Closing, but feel free to reopen with a repro. |
Running any kind of animation example with ani.save leads to following stacktrace (windows 8.1, mpl 1.4.2, python 2.7 64 bit):
The text was updated successfully, but these errors were encountered: