sympy-bot-old icon indicating copy to clipboard operation
sympy-bot-old copied to clipboard

Ignore subprocess' output decoding errors

Open mattpap opened this issue 11 years ago • 8 comments

My xelatex generates output with non UTF8 characters. In effect, symy-bot failed just after testing documentation.

mattpap avatar Mar 04 '13 16:03 mattpap

Are you sure this is really an error that should be silenced? It sounds like you have a bug with your setup. Does the PDF render fine?

asmeurer avatar Mar 04 '13 18:03 asmeurer

I think so. I'm surprised that there weren't problems before (maybe latex version isn't tested very often). Generated PDF looks good (special characters and diacritics are all in place). Only output contains "improperly" encoded characters in warning messages.

mattpap avatar Mar 04 '13 19:03 mattpap

An issue with your terminal then? Both @jrioux (I believe) and myself have been building the PDF just fine.

asmeurer avatar Mar 04 '13 22:03 asmeurer

Encoding errors are nasty because they bring the whole bot to an halt. I have been running the bot from this branch for a bit and it works for me, so if it works for you too, then let's put it in. But can we please just put the 'ignore' directly in the call to decode() instead of defining a global variable?

jrioux avatar Mar 05 '13 09:03 jrioux

Is there an option other than ignore that will not kill the bot but will still print the error? My main concern here is masking some future error.

asmeurer avatar Mar 05 '13 15:03 asmeurer

See http://docs.python.org/2/library/stdtypes.html#str.decode. We can ignore errors, replace invalid byte sequences with 0xfffd (unicode replacement character) or (what I didn't know before) register a callback to handle errors. However, I think the whole idea with decoding process output using terminal encoding is wrong, because we can't assume that a process (like xetex) will respect that (apparently skipping explicit encoding makes decode() work without ignore flag).

mattpap avatar Mar 05 '13 15:03 mattpap

Oh so I guess this is the same as #139. So I have encountered this before :)

asmeurer avatar Mar 16 '13 20:03 asmeurer

So how about writing 'ignore' directly in the call to decode() instead of defining the global _decode_error_action and then let's merge this.

jrioux avatar Apr 09 '13 15:04 jrioux