[issue10754] os.path.isfile doesn't work with some greek characters

2010-12-21 Thread Martin v . Löwis
Martin v. Löwis added the comment: On Windows, using the bytes APIs for filenames is unreliable and fails for characters that are not in the ANSI code page. So you should use import os for i in os.listdir(u'.'): print os.path.isfile(i), '\t', i instead. -- nosy: +loewis

[issue10754] os.path.isfile doesn't work with some greek characters

2010-12-21 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Just a random thought (no, I don't know anything about Windows): there are two "mu" characters: GREEK SMALL LETTER MU (μ) and MICRO SIGN (µ). Normalization turns one into the other: >>> from unicodedata import * >>> name(normalize('NFKC', '\N{MICRO SIG

[issue10754] os.path.isfile doesn't work with some greek characters

2010-12-21 Thread R. David Murray
R. David Murray added the comment: Since the os functions tend to be small wrappers around system functions, this sounds like it is probably a platform issue and not a Python issue. I'm adding our windows experts as nosy, they can reopen the issue if they disagree. -- nosy: +brian.cu

[issue10754] os.path.isfile doesn't work with some greek characters

2010-12-21 Thread Wang Yanjin
Wang Yanjin added the comment: I encoutered this problem on Winxp sp3. I have retested it on the win7, and it could return the correct value as it did on linux. -- ___ Python tracker

[issue10754] os.path.isfile doesn't work with some greek characters

2010-12-21 Thread R. David Murray
R. David Murray added the comment: Oh, yes, and it is likely to be important to know what OS you are on. I tested on linux. -- ___ Python tracker ___ _

[issue10754] os.path.isfile doesn't work with some greek characters

2010-12-21 Thread R. David Murray
R. David Murray added the comment: I am unable to reproduce this on any python from py3k trunk down to 2.6.6. Can you provide a complete test program that demonstrates the failure? (That is, it creates the file and then fails to detect it as a file with isfile.) -- nosy: +r.david.mu

[issue10754] os.path.isfile doesn't work with some greek characters

2010-12-21 Thread Wang Yanjin
New submission from Wang Yanjin : There is a file named "µTorrent.lnk" in the folder. Here is the code: #encoding=utf-8 import os for i in os.listdir('.'): print os.path.isfile(i), '\t', i a = input() and the output: True3.py False aμ汉字.txt TrueuTorrent.lnk False μTorrent.ln