Changing filenames from Greeklish => Greek (subprocess complain)

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Jun 6 21:25:40 EDT 2013


On Thu, 06 Jun 2013 12:17:16 -0700, Νικόλαος Κούρας wrote:

> i can remove the bianry openign from os.listdir but then this will not
> work. MRAB has told me that i need to open those paths and filenames as
> bytestreams and not as unicode strings.

Do you understand why?

If you do not understand *why* we tell you to do a thing, then you have 
no understanding and are doing Cargo Cult programming:

http://en.wikipedia.org/wiki/Cargo_cult_programming
http://en.wikipedia.org/wiki/Cargo_cult


MRAB tells you to work with the bytes, because the file names' bytes are 
invalid when used as UTF-8. If you fix the file names by renaming using a 
terminal set to UTF-8, then they will be valid and you can forget about 
working with bytes.

Working with bytes is only for when the file names are turned to garbage. 
Your file names (some of them) are turned to garbage. Fix them, and then 
use file names as strings.



-- 
Steven



More information about the Python-list mailing list