about special characters

MRAB python at mrabarnett.plus.com
Fri Apr 29 20:32:35 EDT 2016


On 2016-04-30 00:52, Ben Finney wrote:
> Jianling Fan <fanjianling at gmail.com> writes:
>
>> I am trying to use python 27 copying some of my folders and files to
>> another directory.
>
> (There has never been a Python 27. I assume Python 2.7 is what you meant.)
>
>> My code works good for other files but I have some problem to copy
>> files that have some special characters in the filename. like
>> filenames contain Greek "δ" or latin "š".
>
> You may already know that Python 2 handles international text a lot less
> consistently than Python 3.
>
> Is it at all feasible for you to use Python 3 instead? Text handling is
> specifically a big advantage of Python 3.
>
>> it always gave a error that "No such file or directory:"
>
> Please give a complete, small example:
>
> * The actual filenames.
>
> * The exact filesystem encoding that filesystem uses. Be sure to verify that!
>
> * A very small, but complete, Python program which exhibits the
>   behaviour. We will need to be able to run the same program.
>
> * The complete error output (the full traceback).
>
It might be a Unicode problem, i.e. trying to work with bytestrings
(str) instead of Unicode strings (unicode) and using the wrong encoding.



More information about the Python-list mailing list