[issue4829] confusing error for file("foo", "w++")

2010-10-21 Thread Georg Brandl
Georg Brandl added the comment: Amended error message in r85773. -- nosy: +georg.brandl resolution: -> fixed status: open -> closed ___ Python tracker ___ __

[issue4829] confusing error for file("foo", "w++")

2009-06-08 Thread John Szakmeister
John Szakmeister added the comment: The offending lines in io.py are: modes = set(mode) if modes - set("arwb+tU") or len(mode) > len(modes): raise ValueError("invalid mode: %r" % mode) In particular, the "or len(mode) > len(modes)" is picking off the fact that there is repeated

[issue4829] confusing error for file("foo", "w++")

2009-06-02 Thread Ulrich Eckhardt
Ulrich Eckhardt added the comment: Good catch, it just took me a while to actually figure out myself where the bug is. Try the following instead: import io io.FileIO('foo.text', 'w++') This will yield "ValueError: Must have exactly one of read/write/append mode" with 2.6 on win32. I haven'

[issue4829] confusing error for file("foo", "w++")

2009-05-29 Thread John Szakmeister
John Szakmeister added the comment: On trunk, it seems that it's perfectly happy if you specify more than one '+': Python 2.7a0 (trunk, May 29 2009, 05:57:26) [GCC 4.0.1 (Apple Inc. build 5470) (Aspen 5470.3)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>

[issue4829] confusing error for file("foo", "w++")

2009-01-04 Thread Ulrich Eckhardt
New submission from Ulrich Eckhardt : Specifying the '+' more than once while opening a file results in the error "Must have exactly one of read/write/append mode". The attached patch extends that with ".. and at most one optional plus". Further, the patch checks these after the loop that parses