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


Groups > comp.lang.python > #93129

Re: windows and file names > 256 bytes

Subject Re: windows and file names > 256 bytes
References <mailman.44.1435219506.3674.python-list@python.org> <558bc6f1$0$11104$c3e8da3@news.astraweb.com> <CAPTjJmqOK63ifOPJXio4s25J6buxuoFFamFgZrMzpWJDGKSV1A@mail.gmail.com>
From Tim Golden <mail@timgolden.me.uk>
Date 2015-06-25 11:10 +0100
Newsgroups comp.lang.python
Message-ID <mailman.54.1435227018.3674.python-list@python.org> (permalink)

Show all headers | View raw


On 25/06/2015 10:23, Chris Angelico wrote:
> On Thu, Jun 25, 2015 at 7:16 PM, Steven D'Aprano
> <steve+comp.lang.python@pearwood.info> wrote:
>>> 2. Is this a bug in Python? I would prefer if Python dealt with the gory
>>> details of Windows' silly behavior.
>>
>> I would say that it is a bug that it doesn't work with extended-length paths
>> (those starting with \\?\) but may or may not be a bug with regular paths.
> 
> I'd go further and say that the OP is right in expecting Python to
> deal with the gory details. Would it break anything for Python to
> prepend \\?\ to all file names before giving them to certain APIs?
> Then the current behaviour of stripping off that prefix would be fine.
> 
> Are there any times when you *don't* want Windows to use the
> extended-length path?

Yes: when you're passing a relative filepath. Which could pretty much be
any time. As you might imagine, this has come up before -- there's an
issue on the tracker for it somewhere. I just don't think it's simple
enough for Python to know when and when not to use the extended path
syntax without danger of breaking something.

Bear in mind that the \\?\ prefix doesn't just extend the length: it
also allows otherwise special-cased characters such as "." or "..". It's
a general-purpose mechanism for handing something straight to the file
system without parsing it first.

TJG

Back to comp.lang.python | Previous | NextPrevious in thread | Next 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