Path: csiph.com!feeder.erje.net!1.eu.feeder.erje.net!newsfeed0.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!not-for-mail From: MRAB Newsgroups: comp.lang.python Subject: Re: about special characters Date: Sat, 30 Apr 2016 01:32:35 +0100 Lines: 33 Message-ID: References: <85zischt1i.fsf@benfinney.id.au> <77665750-2d18-c0a0-1777-40139a5132c3@mrabarnett.plus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de Dn8VGYmq8cSRRbQ4k9nBRg0lzQ+WS/cHKaCp6bun3oYA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'filenames': 0.07; 'encoding.': 0.09; 'filename.': 0.09; 'filesystem': 0.09; 'subject:characters': 0.09; 'example:': 0.10; 'python': 0.10; 'assume': 0.11; '2.7': 0.13; 'output': 0.13; 'encoding': 0.15; '(there': 0.16; 'behaviour.': 0.16; 'feasible': 0.16; 'filenames.': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'received:192.168.1.4': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'directory.': 0.18; 'handles': 0.20; '(the': 0.22; 'complete,': 0.22; 'uses.': 0.22; 'trying': 0.22; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'error': 0.27; 'handling': 0.27; 'small,': 0.27; 'specifically': 0.28; 'actual': 0.28; '"no': 0.29; 'code': 0.30; 'another': 0.32; 'run': 0.33; 'problem': 0.33; 'that!': 0.33; 'file': 0.34; 'text': 0.35; 'i.e.': 0.35; 'unicode': 0.35; 'but': 0.36; 'instead': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'wrong': 0.38; 'files': 0.38; 'copying': 0.38; 'sure': 0.39; 'received:192': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'complete': 0.63; 'special': 0.73; 'greek': 0.84; 'latin': 0.84 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=K//fZHiI c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=IkcTkHD0fZMA:10 a=pGLkceISAAAA:8 a=9tgT0bPS_hU9UPnwdrQA:9 a=QEXdDO2ut3YA:10 X-AUTH: mrabarnett@:2500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0 In-Reply-To: <85zischt1i.fsf@benfinney.id.au> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <77665750-2d18-c0a0-1777-40139a5132c3@mrabarnett.plus.com> X-Mailman-Original-References: <85zischt1i.fsf@benfinney.id.au> Xref: csiph.com comp.lang.python:107873 On 2016-04-30 00:52, Ben Finney wrote: > Jianling Fan 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.