[Zope-dev] StringIO and Zope
Hi I have a problem with python 2.3.3 and Zope 2.7.0. When I Execute the code below, Python just get som unhandled exceptions, and crash? Why? Does anyone know??? from cStringIO import StringIO #pic[3] is a blob in a database data = "">fil = StringIO(str(data)) #this line makes Zope and Python crash -Tor Oskar Wilhelmsen ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: StringIO and Zope
No the problem is exactly the same with StringIO and cStringIO -Tow - Original Message - From: Tres Seaver [EMAIL PROTECTED] Newsgroups: gmane.comp.web.zope.devel To: Tor Oskar Wilhelmsen [EMAIL PROTECTED] Sent: Monday, July 12, 2004 7:01 PM Subject: Re: StringIO and Zope Tor Oskar Wilhelmsen wrote: I have a problem with python 2.3.3 and Zope 2.7.0. When I Execute the code below, Python just get som unhandled exceptions, and crash? Why? Does anyone know??? from cStringIO import StringIO #pic[3] is a blob in a database data = pic[3] fil = StringIO(str(data)) #this line makes Zope and Python crash Does the problem go away if you change the import to: from StringIO import StringIO From the cStringIO library documentation (http://docs.python.org/lib/module-cStringIO.html): Unlike the memory files implemented by the StringIO module, those provided by this module are not able to accept Unicode strings that cannot be encoded as plain ASCII strings. Tres. -- === Tres Seaver[EMAIL PROTECTED] Zope Corporation Zope Dealers http://www.zope.com ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] StringIO and Zope
Hi I can't print tracebacks. I'm unfortunatly on a windows system, an whats happen is tha Python jus quits, with no fault description. A type(data) gives me DbiRaw, which is the type of data in the DB -TOW - Original Message - From: Tim Peters [EMAIL PROTECTED] To: Tor Oskar Wilhelmsen [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, July 12, 2004 7:41 PM Subject: Re: [Zope-dev] StringIO and Zope [Oskar Wilhelmsen] I have a problem with python 2.3.3 and Zope 2.7.0. When I Execute the code below, Python just get som unhandled exceptions, and crash? What are (exactly) the unhandled exceptions? Can you paste in tracebacks? from cStringIO import StringIO #pic[3] is a blob in a database data = pic[3] fil = StringIO(str(data)) #this line makes Zope and Python crash Since you later said it didn't matter whether you used StringIO or cStringIO, it would be helpful to beak that into two lines: temp = str(data) fil = StringIO(temp) Might also help to print type(data). Since str() and StringIO() are so heavily used, it's unlikely the problem is in either of them. Most likely is a problem in type(data)'s __str__ or __repr__ implementations. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] cStringIO strange errors
Hi I'm using the code below to fetch an image from a database, and for inserting the image as an Image object in ZOPE. The strange thing is that the code causes python to crash, but sometimes it work (for 1 of 10 or something like that).Im using Python 2.3.3 for Windows and Zope 2.7.0 for windows.I don't get any indication about what causing the error, but testing leaves me with an error on the code below. Does anyone know what I have done wrong? imthumb = PIL.Image.open(StringIO(pic[3])) #pic[3] is the blob from the dbimthumb.thumbnail(tsize) btfil = StringIO()imthumb.save(btfil,"JPEG")btfil.seek(0)#thumbnail titlethumbnailtitle = str(pic[1])self.manage_addProduct['OFSP'].thumbnails.manage_addImage(thumbnailid,btfil,thumbnailtitle,"","image/jpeg")btfil.close() - Tor Oskar Wilhelmsen ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Access Zope objects from python
Hi This question is from a Zope newbie, who gets a little confused when trying to write a product for Zope. My product fetches a lot of picture information, and this information shall be viewed in a fotogallery (the viewer is made as a ZPT) My question is really simple then: When I write this product in python, how could I generate a zope image object of each of the pictures in the db. The part I am interested in is how I can access and create zope objects from python. Which classes do I have to inherit from? -Tor Oskar Wilhelmsen ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Zope 2.7.0 and Pythom Image Library
Hi I'm trying to get the PIL(last version on python 2.3) working with Zope, but it seems that it's not working. I use the code: file = StringIO.StringIO(data)im = Image.open(file)im.show() where data is datafrom a blob in a db. This code is working outside Zope, but at once when i try to make it a product in Zope, I get this error: IOError: cannot identify image file Does anyone know what's wrong or what to do to make this work? Thanks for all help! Regards Tor Oskar Wilhelmsen ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Zope 2.7.0 and Pythom Image Library
That was my thought to, but it isn't like that. When I run the code from command line, all works perfectly well. The difference in the command line vs zope is that in the command line the from OFS import SimpleItem is ignored, and I use the class gallerybase: instead of #class gallerybase(SimpleItem.Item): Can the import of SimpleItem, and the inheritance of SimpleItem.Item make som errors?? -TOW - Original Message - From: Andreas Jung [EMAIL PROTECTED] To: Tor Oskar Wilhelmsen [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, July 05, 2004 8:33 AM Subject: Re: [Zope-dev] Zope 2.7.0 and Pythom Image Library If the code works in pure Python then it must work in Zope especially when you call the code from an external method or other filesystem-based code as long as you are using the same Python version. Your problem looks likely that your input data is broken. -aj --On Montag, 5. Juli 2004 8:27 Uhr +0200 Tor Oskar Wilhelmsen [EMAIL PROTECTED] wrote: Hi I'm trying to get the PIL(last version on python 2.3) working with Zope, but it seems that it's not working. I use the code: file = StringIO.StringIO(data) im = Image.open(file) im.show() where data is datafrom a blob in a db. This code is working outside Zope, but at once when i try to make it a product in Zope, I get this error: IOError: cannot identify image file Does anyone know what's wrong or what to do to make this work? Thanks for all help! Regards Tor Oskar Wilhelmsen Andreas Jung zopyx.com - Software Development and Consulting Andreas Jung ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )