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


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

windows and file names > 256 bytes

Started byAlbert-Jan Roskam <fomcl@yahoo.com>
First post2015-06-24 17:45 +0000
Last post2015-07-07 08:56 -0700
Articles 2 — 2 participants

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


Contents

  windows and file names > 256 bytes Albert-Jan Roskam <fomcl@yahoo.com> - 2015-06-24 17:45 +0000
    Re: windows and file names > 256 bytes Tobiah <toby@tobiah.org> - 2015-07-07 08:56 -0700

#93091 — windows and file names > 256 bytes

FromAlbert-Jan Roskam <fomcl@yahoo.com>
Date2015-06-24 17:45 +0000
Subjectwindows and file names > 256 bytes
Message-ID<mailman.23.1435168510.3674.python-list@python.org>
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 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?
2. Is this a bug in Python? I would prefer if Python dealt with the gory 
details of Windows' silly behavior.

Regards,
Albert-Jan

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

[toc] | [next] | [standalone]


#93559

FromTobiah <toby@tobiah.org>
Date2015-07-07 08:56 -0700
Message-ID<mngsqf$dus$1@speranza.aioe.org>
In reply to#93091
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
the prefix)
>
> My questions:
> 1. How can I get the file size of very long paths under XP?

As a workaround, could you use multiple calls to os.chdir()
to get to where you need to do your operations, then use
relative paths from there?

Tobiah

[toc] | [prev] | [standalone]


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


csiph-web