Nick Coghlan <ncogh...@gmail.com> added the comment:

Tinkering with os.path.join, that traceback means that "name" is a str 
instance, while "path" is a bytes instance.

The culprit actually appears to be the fact that the type returned by 
os.listdir (et al) when handed a file descriptor is always a string (this is 
not explicitly documented, a problem in itself, but that's the behaviour I see 
here on linux).

One way to handle this would be to use the filesystem encoding with 
surrogateescape to decode any bytes path passed in to shutil.rmtree (at least 
in the _rmtree_safe_fd case) and handle the actual removal with Unicode 
throughout.

So long as the original encoding of the supplied bytes path is compatible with 
that of the underlying filesystem, surrogateescape should ensure that 
everything round trips correctly.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue4489>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to