Closed eromoe closed 8 years ago
Can you provide an example of your object path
you are trying to print which causes the error? Tell me what it is (e.g. a Python 2 str object containing bytes…) and what it should be (i.e. to which Unicode codepoints it should correspond).
Basically the problem is that the glob
function returns bytes-based str
on Python 2 rather than Unicode. But if you provide Unicode, it returns Unicode as well. So use ext=u'*.xsl*'
and also provide the names of directories as Unicode. You can also use from __future__ import unicode_literals
, so 'something'
means u'something'
by default.
Thank you, the problem solved perfectly!
I have a function like this:
I use glob to get a paths list which may contain Chinese. Then I got error: