17 Jul
2012
17 Jul
'12
1:59 p.m.
On 7/16/2012 11:49 AM, Antoine Pitrou wrote:
On Mon, 16 Jul 2012 15:49:52 +0100 Sven Marnach <sven@marnach.net> wrote:
Currently, there is no obvious way to encode a filename in the default filesystem encoding. To pipe some filenames to the stdin of a subprocess, I effectively used
encoded_name = file_name.encode(sys.getfilesystemencoding()) Well, how about os.fsencode() and os.fsdecode()?
http://docs.python.org/dev/library/os.html#os.fsencode It's too bad these are not called os.path.encode() and os.path.decode(), since they fit so nicely into os.path's charter of manipulating strings representing file paths.
--Ned.
Regards
Antoine.