En Tue, 24 Feb 2009 01:29:07 -0200, venutaurus...@gmail.com
<venutaurus...@gmail.com> escribió:
First of all thanks for your response. I've written a function
as shown below to recurse a directory and return a file based on the
value of n. I am calling this fucntion from my main code to catch that
filename. The folder which it recurses through contains a folder
having files with unicode names (as an example i've given earlier.
---------------------------------------------------------------
def findFile(dir_path):
for name in os.listdir(dir_path):
full_path = os.path.join(dir_path, name)
print full_path
if os.path.isdir(full_path):
findFile(full_path)
Here, you're simply discarding the result from the recursive call. Try
something like this:
result = findFile(full_path)
if result is not None:
return result
else:
n = n - 1
if(n ==0):
return full_path
---------------------------------------------------------------
Now, what happens if you forget about findFile and try with a direct name
instead?
fpath =
r"E:\DataSet\Unicode\UnicodeFiles_8859\001_0006_test_folder\0003testUnicode_ÍÎIÐNOKÔÕÖ×ØUÚÛÜUUßaáâãäåæicéeëeíîidnokôõö÷øuúûüuu.txt.txt"
st = os.stat(path)
print st
--
Gabriel Genellina
--
http://mail.python.org/mailman/listinfo/python-list