Re: windows and file names > 256 bytes

2015-07-07 Thread Tobiah
On 06/24/2015 10:45 AM, 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 th

Re: windows and file names > 256 bytes

2015-06-26 Thread Albert-Jan Roskam
> import os import shutil import sys > > # create an insanely long directory tree p = os.getenv("TEMP") > #p = ur"\\server\share\blah\temp" > tmpdir = p os.chdir(tmpdir) > for i in xrange(1000): > tmpdir = os.path.join(tmpdir, "sub") os.mkdir("?\\" + tmpdir) > #os.mkdir(u"?\\UN

Re: windows and file names > 256 bytes

2015-06-26 Thread Albert-Jan Roskam
On Thu, 25 Jun 2015 14:37:55 +0100, Tim Golden wrote: > 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 p

Re: windows and file names > 256 bytes

2015-06-25 Thread random832
On Thu, Jun 25, 2015, at 09:35, Michael Torrie wrote: > 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. The byte versions of the underlying OS APIs use a 256-chara

Re: windows and file names > 256 bytes

2015-06-25 Thread Terry Reedy
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

Re: windows and file names > 256 bytes

2015-06-25 Thread Tim Golden
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

Re: windows and file names > 256 bytes

2015-06-25 Thread Michael Torrie
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

Re: windows and file names > 256 bytes

2015-06-25 Thread Chris Angelico
On Thu, Jun 25, 2015 at 9:06 PM, Mark Lawrence wrote: >> 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. Check out the multiprocessing modul

Re: windows and file names > 256 bytes

2015-06-25 Thread Tim Golden
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"\\?

Re: windows and file names > 256 bytes

2015-06-25 Thread Joonas Liik
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. So shouldn't it be possible to maniulate these files with extended names.. I mean even if you had to use some special function to ask for long names it

Re: windows and file names > 256 bytes

2015-06-25 Thread Mark Lawrence
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

Re: windows and file names > 256 bytes

2015-06-25 Thread Chris Angelico
On Thu, Jun 25, 2015 at 8:10 PM, Tim Golden wrote: >> 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 o

Re: windows and file names > 256 bytes

2015-06-25 Thread Tim Golden
On 25/06/2015 10:23, Chris Angelico wrote: > On Thu, Jun 25, 2015 at 7:16 PM, Steven D'Aprano > 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 p

Re: windows and file names > 256 bytes

2015-06-25 Thread Chris Angelico
On Thu, Jun 25, 2015 at 7:16 PM, Steven D'Aprano 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 no

Re: windows and file names > 256 bytes

2015-06-25 Thread Steven D'Aprano
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 W

windows and file names > 256 bytes

2015-06-25 Thread Albert-Jan Roskam
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: “WindowsEr

windows and file names > 256 bytes

2015-06-24 Thread Albert-Jan Roskam via Python-list
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). This is even when I u