It looks like append mode is not supported when opening files, I get this exception:
ValueError: invalid mode: 'a'
The code works fine if I use write mode, but obviously that clobbers the file, which is inconvenient. Is there a reason for this, or is it maybe an oversight?
--
Kevin
Append mode not supported for files
Re: Append mode not supported for files
I wouldn't call it "by oversight", but rather, "by design" - being "Micro", all Python features cannot be implemented, certainly not at once. But any features actually needed by users, especially those we hardly can be worked around, and append mode is such - will get into queue to wait for being implemented, if reported to bugtracker: https://github.com/micropython/micropython/issues . When you submit report, please don't forget to specify which MicroPython port you use - for example, unix port does support append mode.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/
-
- Posts: 19
- Joined: Mon Jun 09, 2014 1:54 pm
Re: Append mode not supported for files
Ok I've created a bug report as you suggested: https://github.com/micropython/micropython/issues/676
Thanks for the feedback.
Thanks for the feedback.