Message157093
| Author |
mattchaput |
| Recipients |
mattchaput |
| Date |
2012年03月29日.20:10:45 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1333051846.5.0.756553660947.issue14447@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
In Python 3.2, if you write several values to a file with multiple calls to marshal.dump(), and then try to read them back, the first marshal.load() returns the first value, but reads to the end of the file, so subsequent calls to marshal.load() raise an EOFError.
E.g.:
import marshal
f = open("test", "wb")
marshal.dump(("hello", 1), f)
marshal.dump(("there", 2), f)
marshal.dump(("friend", 3), f)
f.close()
f = open("test", "rb")
print(marshal.load(f)) # ('hello', 1)
print(marshal.load(f)) # ERROR
This page seems to indicate this was also a bug in Python 3.1: http://www.velocityreviews.com/forums/t728526-python-3-1-2-and-marshal.html |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2012年03月29日 20:10:46 | mattchaput | set | recipients:
+ mattchaput |
| 2012年03月29日 20:10:46 | mattchaput | set | messageid: <1333051846.5.0.756553660947.issue14447@psf.upfronthosting.co.za> |
| 2012年03月29日 20:10:45 | mattchaput | link | issue14447 messages |
| 2012年03月29日 20:10:45 | mattchaput | create |
|