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


Groups > comp.lang.python > #93134 > unrolled thread

Re: windows and file names > 256 bytes

Started byMark Lawrence <breamoreboy@yahoo.co.uk>
First post2015-06-25 12:06 +0100
Last post2015-06-25 12:06 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: windows and file names > 256 bytes Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-25 12:06 +0100

#93134 — Re: windows and file names > 256 bytes

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2015-06-25 12:06 +0100
SubjectRe: windows and file names > 256 bytes
Message-ID<mailman.59.1435230406.3674.python-list@python.org>
On 25/06/2015 09: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” 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")
> (Oddly, os.path.getsize(os.path.join("\\\\?", "c:\\dir\\file")) will
> truncate the prefix)
>
> My questions:
> 1. How can I get the file size of very long paths under XP?

Please see 
https://msdn.microsoft.com/en-gb/library/windows/desktop/aa365247(v=vs.85).aspx#maxpath

> 2. Is this a bug in Python? I would prefer if Python dealt with the gory
> details of Windows' silly behavior.

I don't see why Python should work around any particular limitation of 
any given OS.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web