Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder4.news.weretis.net!newsfeed.kpn.net!pfeed08.wxs.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail 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; '(at': 0.03; 'python.': 0.04; 'path,': 0.07; 'received:verizon.net': 0.07; 'terry': 0.07; 'used.': 0.07; 'encoding:': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'utf-8': 0.09; 'am,': 0.13; 'wrote:': 0.15; 'backslashes': 0.16; 'istm': 0.16; 'reedy': 0.16; 'subject:named': 0.16; 'permission': 0.16; '>>>': 0.16; 'exists.': 0.19; 'jan': 0.19; 'subject:not': 0.21; 'header:In-Reply-To:1': 0.22; 'besides': 0.25; 'specified': 0.25; 'string': 0.26; 'unicode': 0.29; 'yes.': 0.30; 'least': 0.31; 'print': 0.32; "skip:' 10": 0.32; 'does': 0.32; 'anyone': 0.33; 'to:addr:python- list': 0.34; 'header:X-Complaints-To:1': 0.34; 'header:User- Agent:1': 0.34; 'there': 0.34; 'characters': 0.34; 'that,': 0.35; 'folder': 0.35; 'skip:" 10': 0.36; 'but': 0.37; 'received:org': 0.38; 'subject:: ': 0.38; 'steven': 0.38; 'something': 0.38; 'else': 0.38; 'should': 0.39; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'why?': 0.73; 'subject:skip:o 10': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: os.path.isdir do not work for Foder named '2011-07-03' Date: Tue, 19 Jul 2011 13:51:09 -0400 References: <0bf400a3-735c-487a-8d74-feb3b56be99b@g5g2000prn.googlegroups.com> <4e250b31$0$30001$c3e8da3$5496439d@news.astraweb.com> <1704833.GPiq6Xz2PA@PointedEars.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Gmane-NNTP-Posting-Host: pool-74-109-121-73.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.18) Gecko/20110616 Lightning/1.0b2 Thunderbird/3.1.11 In-Reply-To: <1704833.GPiq6Xz2PA@PointedEars.de> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1311098111 news.xs4all.nl 23974 [2001:888:2000:d::a6]:56123 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:9903 On 7/19/2011 2:15 AM, Thomas 'PointedEars' Lahn wrote: > Steven D'Aprano wrote: > >> Nulpum wrote: >>> I want to make sure that folder exists. >>> >>> '2011-07-03' is really exists. but 'os.path.isdir' say false >>> >>> Does anyone know why? >> >> Yes. >> >>>>> print "logs/2011-07-03" >> logs/2011-07-03 >>>>> print "logs\2011-07-03" >> logs=EF=BF=BD1-07-03 >> >> Don't use backslashes as path separators in Python. Backslashes are us= ed >> for string escapes. > > Besides that, and permission issues, ISTM that there are Unicode charac= ters > (at least non-ASCII characters) in the OP's path, which means they shou= ld > declare > > # encoding: utf-8 That is the default in Py3. Not sure of OP specified what he used. > > or something else fitting, and use > > os.path.isdir(u"C:/Users/=EC=A1=B0=EC=B0=BD=EC=A4=80/Desktop/logs/2011-= 07-03") > --=20 Terry Jan Reedy