<div dir="ltr">Sorry, I've forgot to use "Reply All".<br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 12, 2016 at 9:49 AM, INADA Naoki <span dir="ltr"><<a href="mailto:songofacandy@gmail.com" target="_blank">songofacandy@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">IHMO it's safer to get an encoding error rather than no error when you concatenate two byte strings encoded to two different encodings (mojibake).</p>
<p dir="ltr">print(os.fspath(obj)) will more likely do what you expect if os.fspath() always return str. I mean that it will encode your filename to the encoding of the terminal which can be different than the filesystem encoding.</p>
<p dir="ltr">If fspath() can return bytes, you should write print(os.fsdecode(os.fspath(obj))).</p>
<p dir="ltr"></p></blockquote><div><br></div></span><div>Why not print(obj)?</div><div>str() is normal high-level API, and __fspath__ and os.fspath() should be low level API.</div><div>Normal users shouldn't use __fspath__ and os.fspath(). Only library developers should use it.</div></div><span class="HOEnZb"><font color="#888888"><div><br></div>-- <br><div>INADA Naoki <<a href="mailto:songofacandy@gmail.com" target="_blank">songofacandy@gmail.com</a>></div>
</font></span></div></div>
</blockquote></div><br><div>-- <br></div><div class="gmail_signature">INADA Naoki <<a href="mailto:songofacandy@gmail.com" target="_blank">songofacandy@gmail.com</a>></div>
</div></div>