Author ncoghlan
Recipients Arfrever, eric.araujo, ezio.melotti, georg.brandl, hynek, jcea, larry, loewis, mrts, ncoghlan, neologix, petri.lehtinen, pitrou, python-dev, rosslagerwall, schmir, tarek, teamnoir
Date 2012-06-25.03:18:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1340594335.78.0.785867991206.issue4489@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2012-06-25 03:18:56ncoghlansetrecipients: + ncoghlan, loewis, georg.brandl, jcea, pitrou, larry, schmir, tarek, ezio.melotti, eric.araujo, Arfrever, mrts, neologix, teamnoir, rosslagerwall, python-dev, petri.lehtinen, hynek
2012-06-25 03:18:55ncoghlansetmessageid: <1340594335.78.0.785867991206.issue4489@psf.upfronthosting.co.za>
2012-06-25 03:18:55ncoghlanlinkissue4489 messages
2012-06-25 03:18:54ncoghlancreate