Prev: modifying openoffice/xls spreadsheet (without OO /Excel installed)
Next: ooolib, reading writing a spread sheet and keep formatting
From: Dodo on 29 Apr 2010 12:33 Le 29/04/2010 17:07, Antoine Pitrou a écrit : > Le Thu, 29 Apr 2010 12:53:53 +0200, Dodo a écrit : >> >> @Antoine : It not sys.stdout.buffer.write but sys.stdout.write() >> instead. But it still doesn't work, now I have empty content > > Let me insist: please use sys.stdout.buffer.write(). > You'll also have to call sys.stdout.flush() before doing so. > > Oh, I tested on my windows machine avec sys.stdout.buffer.write() didn't work. I just tested on my linux server, and it works.... So, let's modify the script sys.stdout.buffer.write( f.read() ) sys.stdout.flush() Now I have: malformed header from script. Bad header=ÿØÿà: show.py and it tells me Internal Server error :( I can't see the error messages (traceback) any idea to do so? Dorian
From: Antoine Pitrou on 29 Apr 2010 16:21 Le Thu, 29 Apr 2010 18:33:08 +0200, Dodo a écrit : > Oh, I tested on my windows machine avec sys.stdout.buffer.write() didn't > work. > I just tested on my linux server, and it works.... > > So, let's modify the script > > sys.stdout.buffer.write( f.read() ) > sys.stdout.flush() Sorry, I should have been clearer. You have to flush sys.stdout before using sys.stdout.buffer, such that the unicode layer doesn't keep any unwritten data. So this should be: sys.stdout.flush() sys.stdout.buffer.write( f.read() ) Regards Antoine.
From: Dodo on 29 Apr 2010 17:37 Le 29/04/2010 22:21, Antoine Pitrou a écrit : > Le Thu, 29 Apr 2010 18:33:08 +0200, Dodo a écrit : >> Oh, I tested on my windows machine avec sys.stdout.buffer.write() didn't >> work. >> I just tested on my linux server, and it works.... >> >> So, let's modify the script >> >> sys.stdout.buffer.write( f.read() ) >> sys.stdout.flush() > > Sorry, I should have been clearer. You have to flush sys.stdout before > using sys.stdout.buffer, such that the unicode layer doesn't keep any > unwritten data. So this should be: > > sys.stdout.flush() > sys.stdout.buffer.write( f.read() ) > > Regards > > Antoine. > .....I don't get a thing. Now with the fix : All browsers shows a different thing, but not the image! http://ddclermont.homeip.net/misc/python/ If I save it to computer : * Windows image viewer won't read it * Irfanview can read it without problems Dorian PS : ça commence sérieusement à m'énerver
From: Dodo on 29 Apr 2010 17:43 Le 29/04/2010 18:33, Dodo a écrit : > Le 29/04/2010 17:07, Antoine Pitrou a écrit : >> Le Thu, 29 Apr 2010 12:53:53 +0200, Dodo a écrit : >>> >>> @Antoine : It not sys.stdout.buffer.write but sys.stdout.write() >>> instead. But it still doesn't work, now I have empty content >> >> Let me insist: please use sys.stdout.buffer.write(). >> You'll also have to call sys.stdout.flush() before doing so. >> >> > Oh, I tested on my windows machine avec sys.stdout.buffer.write() didn't > work. > I just tested on my linux server, and it works.... > > So, let's modify the script > > sys.stdout.buffer.write( f.read() ) > sys.stdout.flush() > > Now I have: > malformed header from script. Bad header=ÿØÿà: show.py > and it tells me Internal Server error :( > > I can't see the error messages (traceback) > any idea to do so? > > Dorian Ok, I just checked, the CRC of the file in the server is not the same the in the browser I don't understand how the data could be modified... Dorian
From: Antoine Pitrou on 30 Apr 2010 11:52
Le Thu, 29 Apr 2010 23:37:32 +0200, Dodo a écrit : > ....I don't get a thing. > Now with the fix : > All browsers shows a different thing, but not the image! > http://ddclermont.homeip.net/misc/python/ > > If I save it to computer : > * Windows image viewer won't read it > * Irfanview can read it without problems Did you set the content-type and content-length in the HTTP headers? Can you post your code? |