Re: [Zope] Re: windos and linux

2007-05-27 Thread Einar Næss Jensen

On 5/27/07, Josef Meile <[EMAIL PROTECTED]> 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
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: windos and linux

2007-05-27 Thread Josef Meile


>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
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] windos and linux

2007-05-27 Thread Martijn Pieters

On 5/27/07, Einar Næss Jensen <[EMAIL PROTECTED]> 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
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] windos and linux

2007-05-27 Thread Andreas Jung



--On 27. Mai 2007 20:45:18 +0200 Einar Næss Jensen 
<[EMAIL PROTECTED]> 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

pgpqw1S0sbGWr.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] windos and linux

2007-05-27 Thread Einar Næss Jensen

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.
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )