Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'string.': 0.04; 'paths': 0.05; 'default.': 0.07; 'subject:file': 0.07; 'wrapper': 0.07; 'mentions': 0.09; 'python': 0.11; 'def': 0.14; 'from:addr:timgolden.me.uk': 0.16; 'from:name:tim golden': 0.16; 'message-id:@timgolden.me.uk': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'subject:windows': 0.16; 'tjg': 0.16; 'wrote:': 0.16; 'basically': 0.18; '>>>': 0.20; 'windows': 0.20; '3.x': 0.22; 'am,': 0.23; 'absolute': 0.23; 'errors': 0.23; 'passing': 0.23; 'header:In-Reply-To:1': 0.24; 'tim': 0.24; 'header:User-Agent:1': 0.26; 'possibility': 0.27; 'function:': 0.29; 'work.': 0.30; 'certainly': 0.31; 'probably': 0.32; 'michael': 0.33; "he's": 0.33; 'received:192.168.100': 0.33; 'file': 0.34; 'could': 0.35; 'to:addr:python-list': 0.35; 'path': 0.35; 'unicode': 0.35; 'problem.': 0.35; 'but': 0.36; 'there': 0.36; 'possible': 0.36; 'subject:: ': 0.37; 'names': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'where': 0.40; 'him': 0.60; 'your': 0.60; 'even': 0.61; 'more': 0.62; 'charset:windows-1252': 0.65; 'from:addr:mail': 0.70; 'sounds': 0.72; '2.7.': 0.84; 'pain': 0.84 Subject: Re: windows and file names > 256 bytes To: python-list@python.org References: <558BF55C.2010701@timgolden.me.uk> <558C038A.5010103@gmail.com> From: Tim Golden Date: Thu, 25 Jun 2015 14:37:55 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 MIME-Version: 1.0 In-Reply-To: <558C038A.5010103@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1435239479 news.xs4all.nl 2958 [2001:888:2000:d::a6]:49007 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:93142 On 25/06/2015 14:35, Michael Torrie wrote: > On 06/25/2015 06:34 AM, Tim Golden wrote: >> On 25/06/2015 13:04, Joonas Liik wrote: >>> It sounds to me more like it is possible to use long file names on windows >>> but it is a pain and in python, on windows it is basically impossible. >> >> Certainly not impossible: you could write your own wrapper function: >> >> def extended_path(p): >> return r"\\?\%s" % os.path.abspath(p) >> >> where you knew that there was a possibility of long paths and that an >> absolute path would work. > > The OP mentions that even when he manually supplies extended paths, > os.mkdir, os.getsize, and shutil.rmtree return errors for him in Python > 2.7. So there's more to this problem. > He's probably not passing unicode strings: the extended path only works for unicode string. For 3.x that's what you do by default. TJG