os.path.walk usage on WinXP

A

Alex Popescu

Hi all!

I am trying to use the os.path.walk function, but I am getting a weird
error:

def _walk(dir_name):
def selector(arg, dirname, fnames):
print "selector"

os.path.walk(dir_name, selector, None)

File "C:\zengarden\python\python25\lib\ntpath.py", line 325, in walk
names = os.listdir(top)
TypeError: coercing to Unicode: need string or buffer, list found

After searching through the documentation the only thing that I've found is
the comment on os.listdir(path):

Changed in version 2.3: On Windows NT/2k/XP and Unix, if path is a Unicode
object, the result will be a list of Unicode objects.

Unfortunately, I have no idea what to do next.

TIA,
../alex
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top