Re: How to bypass Windows 'cooking' the I/O? (One more time, please)

norseman wrote:

I know I saw the answer recently, as in since February '08, but I can't re-find it. :( I tried the mail archives and such and my own collections but the piece I saw still eludes me.

Problem: (sos=same old s...) Microsoft insists the world work it's way even when the Microsoft way was proven wrong decades ago. In this case it's (still) 'cooking' the writes even with 'rwb' and O_RDWR|O_BINARY in (proper respective) use.

Specific: python created and inspected binary file ends:
00460: 0D 1A (this is correct)

after a write
os.lseek(target, -1, 2)
the expected result would be:
00460: 0D 20 bytes.... 1A

BUT I get:
00460: 20 .... data bytes... 1A

It is one byte off!!! And the 0D has to be there. Signifies the end of the header.

Same python program runs as expected in Linux. Maybe because that's where it was written?! :)

What I seek is the way to slap Microsoft up side the head and make it work correctly. OK, well, at least in this situation.

Note: Things like this justify Python implementers bypassing OS calls (data fetch, data write) and using the BIOS direct. Remember, the CPU understands bit patterns only. It has no comprehension of 'text', 'program', 'number', 'pointer', blah blah blah.... All that is totally beyond it's understanding. A given bit pattern means 'do that'. The CPU is 100% binary. Memory, storage and the rest is just bits-on, bits-off.
Patterns. Proper binary I/O is mandatory for the machine to function.

Anyway - if whoever mentioned the flags and such to 'over ride' Microsoft's BS would re-send that piece I would be very appreciative.


Since you didn't show any code context, I'll try my mind reading superpowers.....

You may be the victim of buffering (not calling .flush() or .close() to commit your write to disk). Why aren't you using the file object to do you seek and write?

Normal file I/O sequence:

fp = open(target, 'wb'), 2)


by going through os. methods instead of the file instance I think you are accessing the file through 2 different I/O buffers. I could be all wrong here.


Relevant Pages

  • How to bypass Windows cooking the I/O? (One more time, please)
    ... Microsoft insists the world work it's way even when the Microsoft way was proven wrong decades ago. ... Same python program runs as expected in Linux. ... the CPU understands bit patterns only. ...
  • Re: The Microsoft Platform Ahead by David Platt; thoughts about Python and Zope
    ... > I would be concerned if Microsoft was pushing for patents on things ... > previously implemented by Python or Zope. ... >>standalone language and one of the Microsoft CLR ...
  • =?Windows-1252?Q?Re:_Basis_f=FCr_My.FileSystem.DeleteFile?=
    ... als auch das intellektuelle Niveau angeht) eine Diskussion über die Tauglichkeit der CLR als Basis für dynamische Sprachen wie Python oder Ruby. ... Du hast völlig richtig diagnostiziert, dass Microsoft im Hobby-Bereich ein Konzept und ein Produkt fehlt, aber das Problem geht weit tiefer, als dass man es mit dem ... und Python. ... Und diese Zugriffe sind mit dem .NET-Framework nun allemal gegeben. ...
  • Re: how to capture time interval?
    ... Microsoft Visual C# .NET - Step by Step" from Microsoft Press covers the how ... of OOP, unfortunately not the why of OOP. ... The GOF are Erich Gamma, ... Once you have a good solid handle on OO and Patterns I consider Martin ...
  • accessing Microsoft Works document through COM interface in Python
    ... I am tryin to use Microsoft Works Wordprocessor from Python ... It seems like IDispatch is not implemented by Microsoft Works ... class AcWp(CoClassBaseClass): # A CoClass ... The generated .py file as a few different IIDs and I am not sure how ...