codeprep icon indicating copy to clipboard operation
codeprep copied to clipboard

why use byte not str while in path (Windows)

Open lyksdu opened this issue 5 years ago • 0 comments

https://github.com/giganticode/codeprep/blob/f5a35b68fab930e095a99dbd83e27f63c23552a4/codeprep/pipeline/to_repr.py#L60

eh, I am working with this repository. on windows

I find when I use unicode like chinese in path like "./文档/", to_repr.py is likely to encode this string to bytes, this cause Exception.

unicode bytes like b'\xe6\x96\x87\xe6\xa1\xa3.py' which means ”文档.py“ , in Windows, it means a recursive folder. And python built-in function os.path.basename will not recognize this. When writing MetaData to file, this will raise a FileOrDirNotExist Exception

actually, I change the path to str to avoid this exception, but I dont know if there are any other side effects

lyksdu avatar May 02 '20 02:05 lyksdu