[issue22651] Open file in a+ mode reads from end of file in Python 3.4

2017-01-26 Thread STINNER Victor

STINNER Victor added the comment:

On Python 2, it's easy to workaround the issue, just always go the end 
explicitly:

   f = open(filename, "a+")
   f.seek(0, os.SEEK_END)

Or use the io module which doesn't use the stdio of the C library and has a 
portable and reliable behaviour:

   f = io.open(filename, "a+")


Georg Brandl: "This is a somewhat unfortunate difference between the major C 
libs and Python's new IO, but probably too late to change."

Since it's easy to workaround the issue and only one user complained lat 2 
years (3 years?), sorry, I close now the issue.

I add this bug to my long list of bugs in the C stdio which won't be fixed in 
Python 2...
http://haypo-notes.readthedocs.io/python.html#bugs-in-the-c-stdio-used-by-the-python-i-o

--
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22651] Open file in a+ mode reads from end of file in Python 3.4

2017-01-25 Thread STINNER Victor

Changes by STINNER Victor :


--
Removed message: http://bugs.python.org/msg286294

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22651] Open file in a+ mode reads from end of file in Python 3.4

2017-01-25 Thread Caitlin

Caitlin added the comment:

Yeah, the workaround seemed to work for me when trying to open file on 
http://buywebsitetrafficreviews.org/, but this should be fixed somehow anyway.

--
nosy: +caitlinwalker37

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22651] Open file in a+ mode reads from end of file in Python 3.4

2014-10-16 Thread Nick Jacobson

New submission from Nick Jacobson:

In Python 2.7.8.10 running the following gives one result:

 with open(rC:\myfile.txt, a+) as f:
... f.tell()
...
0L

But in Python 3.4.1.0 it gives a different result:

 with open(rC:\myfile.txt, a+) as f:
... f.tell()
...
98

According to the man page for fopen, for a+ mode: The initial file position 
for reading is at the beginning of the file. Source: 
http://linux.die.net/man/3/fopen

--
components: IO
messages: 229511
nosy: nicksjacobson
priority: normal
severity: normal
status: open
title: Open file in a+ mode reads from end of file in Python 3.4
type: behavior
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22651
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22651] Open file in a+ mode reads from end of file in Python 3.4

2014-10-16 Thread Nick Jacobson

Nick Jacobson added the comment:

Note: I'm running this in Windows 7, same result on Windows Server 2008.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22651
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22651] Open file in a+ mode reads from end of file in Python 3.4

2014-10-16 Thread Nick Jacobson

Nick Jacobson added the comment:

I also should have mentioned that C:\myfile.txt in my example is 98 bytes long, 
so it is being read from the end instead of the beginning.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22651
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22651] Open file in a+ mode reads from end of file in Python 3.4

2014-10-16 Thread eryksun

Changes by eryksun eryk...@gmail.com:


--
title: Python 2: Open file in a+ mode doesn't go to the end - Open file in a+ 
mode reads from end of file in Python 3.4
versions: +Python 3.4, Python 3.5 -Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22651
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com