Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #93154

Re: windows and file names > 256 bytes

Path csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
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; 'skip:\\ 20': 0.05; 'bug.': 0.07; 'filename': 0.07; 'skip:\\ 10': 0.07; 'subject:file': 0.07; 'url:msdn': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'skip:u 60': 0.09; 'truncate': 0.09; 'python': 0.11; 'jan': 0.11; '2.7': 0.13; 'notations': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:windows': 0.16; 'win7': 0.16; 'wrote:': 0.16; 'skip:u 30': 0.18; '(not': 0.20; 'windows': 0.20; 'extension': 0.20; 'am,': 0.23; '2015': 0.23; 'seems': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; '[2]': 0.27; 'terry': 0.29; 'reporting': 0.29; 'e.g.': 0.31; 'operations': 0.31; '[1]': 0.32; "d'aprano": 0.33; 'steven': 0.33; 'windows.': 0.33; 'open': 0.33; 'to:addr:python-list': 0.35; 'fail': 0.35; 'path': 0.35; 'possible,': 0.35; 'unicode': 0.35; 'skip:o 20': 0.35; 'too': 0.36; 'limitation': 0.36; 'hi,': 0.37; 'subject:: ': 0.37; 'received:org': 0.38; 'url:microsoft': 0.39; 'to:addr:python.org': 0.39; 'sure': 0.40; 'where': 0.40; 'even': 0.61; 'more': 0.62; 'making': 0.64; 'thursday': 0.66; 'skip:\xe2 10': 0.70; 'worth': 0.73; '3.4': 0.84; '[error': 0.84; 'calls,': 0.84; 'prefix)': 0.84; 'received:fios.verizon.net': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: windows and file names > 256 bytes
Date Thu, 25 Jun 2015 13:03:53 -0400
References <mailman.44.1435219506.3674.python-list@python.org> <558bc6f1$0$11104$c3e8da3@news.astraweb.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding quoted-printable
X-Gmane-NNTP-Posting-Host pool-98-114-97-173.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1
In-Reply-To <558bc6f1$0$11104$c3e8da3@news.astraweb.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.73.1435251908.3674.python-list@python.org> (permalink)
Lines 53
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1435251908 news.xs4all.nl 2965 [2001:888:2000:d::a6]:40700
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:93154

Show key headers only | View raw


On 6/25/2015 5:16 AM, Steven D'Aprano wrote:
> On Thursday 25 June 2015 18:00, Albert-Jan Roskam wrote:
>
>> Hi,
>>
>> Consider the following calls, where very_long_path is more than 256 bytes:
>> [1] os.mkdir(very_long_path)
>> [2] os.getsize(very_long_path)
>> [3] shutil.rmtree(very_long_path)
>>
>> I am using Python 2.7 and [1] and [2] fail under Windows XP [3] fails
>> under Win7 (not sure about XP). It throws: “WindowsError: [Error 206] The
>> filename or extension is too long”
>
> I don't think this is a bug. It seems to be a limitation of Windows.
>
> https://msdn.microsoft.com/en-
> us/library/windows/desktop/aa365247%28v=vs.85%29.aspx#maxpath
>
>> This is even when I use the "special"
>> notations \\?\c:\dir\file or \\?\UNC\server\share\file, e.g.
>> os.path.getsize("\\\\?\\" + "c:\\dir\\file")
>
> However, that may be a bug.
>
> What happens if you use a Unicode string?
>
> path = u"\\\\?\\c:a\\very\\long\\path"
> os.mkdir(path)
>
>
> Can you open an existing file?
>
> open(u"\\\\?\\c:a\\very\\long\\path\\file.txt")
>
>
>
>> (Oddly, os.path.getsize(os.path.join("\\\\?", "c:\\dir\\file")) will
>> truncate the prefix)
>
> That's worth reporting as a bug.

If possible, please try the same operations with Python 3.4 or .5 before 
making a report


-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

windows and file names > 256 bytes Albert-Jan Roskam <sjeik_appie@hotmail.com> - 2015-06-25 08:00 +0000
  Re: windows and file names > 256 bytes Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-06-25 19:16 +1000
    Re: windows and file names > 256 bytes Chris Angelico <rosuav@gmail.com> - 2015-06-25 19:23 +1000
    Re: windows and file names > 256 bytes Tim Golden <mail@timgolden.me.uk> - 2015-06-25 11:10 +0100
    Re: windows and file names > 256 bytes Chris Angelico <rosuav@gmail.com> - 2015-06-25 20:23 +1000
    Re: windows and file names > 256 bytes Terry Reedy <tjreedy@udel.edu> - 2015-06-25 13:03 -0400

csiph-web