os.path.walk usage on WinXP

Alex Popescu nospam.themindstorm at gmail.com
Thu Jul 26 07:22:00 EDT 2007


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):

[quote]
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.
[/quote]

Unfortunately, I have no idea what to do next. 

TIA,
./alex
--
.w( the_mindstorm )p.




More information about the Python-list mailing list