this snippet behaves differently on windows and linux: http://zope.pastey.net/42188-1gbl I would be thankful of any clues to why. in linux it copies a gif picture off the filesystem and into the zodb. In windows. the object gets created but no gif is present.also no errors in the log -- -- Einar Næss Jensen http://einarblog.homemade.no/einarblog http://www.homemade.no tlf: +47 90990249 (\__/) (='.'=)This is Bunny. Copy and paste bunny into your (")_(")signature to help him gain world domination.
--On 27. Mai 2007 20:45:18 +0200 Einar Næss Jensen <einar.nass.jensen@gmail.com> wrote:
this snippet behaves differently on windows and linux: http://zope.pastey.net/42188-1gbl
I would be thankful of any clues to why. in linux it copies a gif picture off the filesystem and into the zodb. In windows. the object gets created but no gif is present.also no errors in the log
This code is pretty much worthless without knowing the code for the ProfilPicture implementation. Likely your image can't be read under Windows (for whatever reason). You should use pdb and debug the related code on Windows. -aj
On 5/27/07, Einar Næss Jensen <einar.nass.jensen@gmail.com> wrote:
this snippet behaves differently on windows and linux: http://zope.pastey.net/42188-1gbl
I would be thankful of any clues to why. in linux it copies a gif picture off the filesystem and into the zodb. In windows. the object gets created but no gif is present.also no errors in the log
Use open(dir, 'rb').read() instead, opening the file in binary mode. Windows treats textfiles and binary files differently, thus mangling your GIF file if opened in text mode. -- Martijn Pieters
windos and linux windos? Is it a new version of DOS? ;-)
this snippet behaves differently on windows and linux: http://zope.pastey.net/42188-1gbl Why don't you try to directly create a OFS.Image directly into the zopedb, then see if this still happens. It would help you to discard any error inside the ProfilePicture class.
Best regards Josef
On 5/27/07, Josef Meile <jmeile@hotmail.com> wrote:
windos and linux windos? Is it a new version of DOS? ;-)
No. Pretty much the same as it always was.
this snippet behaves differently on windows and linux: http://zope.pastey.net/42188-1gbl Why don't you try to directly create a OFS.Image directly into the zopedb, then see if this still happens. It would help you to discard any error inside the ProfilePicture
I failed to mention that ProfilePicture was actually an OFS.Image Martijn Pieters showed the solution: open the file as a binary file. python documentation has this to say about the issue: When opening a binary file, you should append 'b' to the mode value to open the file in binary mode, which will improve portability. Thanks to everyone.... Einar Næss Jensen
participants (4)
-
Andreas Jung -
Einar Næss Jensen -
Josef Meile -
Martijn Pieters