Νικόλαος Κούρας <nikos.gr...@gmail.com> writes: > Now the error afetr fixithg that transformed to: > > [Thu Jun 06 22:13:49 2013] [error] [client 79.103.41.173] filename = > fullpath.replace( '/home/nikos/public_html/data/apps/', '' ) > [Thu Jun 06 22:13:49 2013] [error] [client 79.103.41.173] TypeError: expected > bytes, bytearray or buffer compatible object > > MRAB has told me that i need to open those paths and filenames as bytestreams > and not as unicode strings.
Yes, that way the function will return a list of bytes instances. Knowing that, consider the following example, that should ring a bell: $ python3 Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 09:59:04) [GCC 4.7.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>> path = b"some/path" >>> path.replace('some', '') Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: expected bytes, bytearray or buffer compatible object >>> path.replace(b'some', b'') b'/path' >>> ciao, lele. -- nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia. l...@metapensiero.it | -- Fortunato Depero, 1929. -- http://mail.python.org/mailman/listinfo/python-list