I'm building a per-user file browsing/uploading application using Django and when I run this function
def walkdeep(request, path):
path, dirs, files = walktoo('/home/damon/walktemp/%s' % path)
return render_to_response('walk.html', {
'path' : path[0],
'dirs' : path[1],
'files' : path[2],
}, context_instance=RequestContext(request))
def walktoo(dir):
for path, dirs, files in os.walk(dir):
yield path, dirs, files
print path, dirs, files
I get this error:
need more than 1 value to unpack
Also, i know this is a silly way to do this, any advice would be appreciated.
edit:
this was actually very silly on my part, i completely forgot about os.listdir(dir) which is a much more reasonable function for my purposes. if you use the selected answer, it clears up the above issue i was having, but not with the results i wanted.