Michael Mol added the comment: I need to remember not to try to write quick programs in Python that need O_DIRECT.
My use case: I'm attempting to write a program that forces the disk to seek to a particular place, as part of burning in the disk. My algorithm goes: 1. Seek to the beginning of the disk 2. Write to the disk 3. Seek to the end of the disk 4. Write to the disk 5. Seek to the beginning of the disk 6. Read from the disk 7. Seek to the end of the disk 8. Read from the disk It then repeats with offsets, leading the seek distance to shrink until the two positions overlap at the center of the disk, and then expand as the positions diverge to the opposite end of the disk from where they began. It's straightforward, and can be done using mmap and os.write as far as the writing side of things goes, but it does not work on the reading side, as even this workaround does not work: d = os.open(disk_file_path, os.O_RDWR | os.O_DIRECT | os.O_SYNC | os.O_DSYNC) readbuf = mmap.mmap(-1, 4096) os.lseek(d, 0, os.SEEK_SET) fo = os.fdopen(d, 'rb') fo.readinto(readbuf) ... I get errno 22 on the final line. Apparently, code similar to that used to work, but no longer does. ---------- nosy: +Michael Mol _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5396> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com