In fact it is not working with unicode too :

#!/usr/bin/python
import magic, os
mime = magic.open(magic.MAGIC_MIME)
mime.load()

class A(unicode):
    def __div__(self, rel):
        return A(os.path.join(self, rel))
    def listdir(self):
        return [self / child for child in os.listdir(self)]
    isdir = os.path.isdir
    def walk(self):
        for child in self.listdir():
            yield child
            if child.isdir():
                for item in child.walk():
                    yield item
    def getmime(self):
        return mime.file(self)

path = '/home/ftp/grey'
for i in A(path).walk():
    print i.getmime()


Traceback (most recent call last):
  File "./tst.py", line 23, in ?
    print i.getmime()
  File "./tst.py", line 19, in getmime
    return mime.file(self)


locale
LANG=ru_RU.UTF-8


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to