Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
web.py' net.py
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  12 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Patrick  
View profile  
 More options Feb 9 2012, 6:39 am
From: Patrick <perdmann...@googlemail.com>
Date: Thu, 09 Feb 2012 12:39:17 +0100
Local: Thurs, Feb 9 2012 6:39 am
Subject: web.py' net.py
Hi,

when i try to upload images i get following Error:
UnicodeDecodeError: 'utf8' codec can't decode byte 0xff in position 0:
invalid start byte

. Everything works fine until i call Image.open(f), from PIL import Image.

x = web.input(bilder={})
b = Bilder()
b.set_image(x.bilder.file)
b.save()

...
class Bilder(Document):
...
def set_image(self, f):
   _i = Image.open(f, 'wb')
...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Patrick Erdmann  
View profile  
 More options Feb 9 2012, 6:38 am
From: Patrick Erdmann <patr...@perdmann.de>
Date: Thu, 09 Feb 2012 12:38:52 +0100
Local: Thurs, Feb 9 2012 6:38 am
Subject: web.py' net.py
Hi,

when i try to upload images i get following Error:
UnicodeDecodeError: 'utf8' codec can't decode byte 0xff in position 0:
invalid start byte

. Everything works fine until i call Image.open(f), from PIL import Image.

x = web.input(bilder={})
b = Bilder()
b.set_image(x.bilder.file)
b.save()

...
class Bilder(Document):
...
def set_image(self, f):
   _i = Image.open(f, 'wb')
...

--
Mit freundlichen Gr en

Patrick Erdmann

XMPP/Mail: patr...@perdmann.de


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Primoz Anzur  
View profile  
 More options Feb 9 2012, 10:23 am
From: Primoz Anzur <stormchas...@gmail.com>
Date: Thu, 9 Feb 2012 16:23:24 +0100
Local: Thurs, Feb 9 2012 10:23 am
Subject: Re: [webpy] web.py' net.py

What is 'f'? Is it image data or the filename?

On Thu, Feb 9, 2012 at 12:38 PM, Patrick Erdmann <patr...@perdmann.de>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Patrick Erdmann  
View profile  
 More options Feb 10 2012, 1:58 pm
From: Patrick Erdmann <patr...@perdmann.de>
Date: Fri, 10 Feb 2012 19:58:39 +0100
Local: Fri, Feb 10 2012 1:58 pm
Subject: Re: [webpy] web.py' net.py
f is image data, see here:

x = web.input(bilder={})
b.set_image(x.bilder.file)
----
f = x.bilder.file
----

Am 09.02.2012 16:23, schrieb Primoz Anzur:

--
Mit freundlichen Gr en

Patrick Erdmann

XMPP/Mail: patr...@perdmann.de


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Primoz Anzur  
View profile  
 More options Feb 11 2012, 2:47 am
From: Primoz Anzur <stormchas...@gmail.com>
Date: Sat, 11 Feb 2012 08:47:40 +0100
Local: Sat, Feb 11 2012 2:47 am
Subject: Re: [webpy] web.py' net.py

This is not how you use PIL
http://www.pythonware.com/library/pil/handbook/image.htm

Image.open(infile) => image
Image.open(infile, mode) => image

On Fri, Feb 10, 2012 at 7:58 PM, Patrick Erdmann <patr...@perdmann.de>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Primoz Anzur  
View profile  
 More options Feb 11 2012, 2:50 am
From: Primoz Anzur <stormchas...@gmail.com>
Date: Sat, 11 Feb 2012 08:50:49 +0100
Local: Sat, Feb 11 2012 2:50 am
Subject: Re: [webpy] web.py' net.py

Maybe you've wanted Image.frombuffer() or Image.fromstring()?

On Sat, Feb 11, 2012 at 8:47 AM, Primoz Anzur <stormchas...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Patrick Erdmann  
View profile  
 More options Feb 13 2012, 9:27 am
From: Patrick Erdmann <patr...@perdmann.de>
Date: Mon, 13 Feb 2012 15:27:34 +0100
Local: Mon, Feb 13 2012 9:27 am
Subject: Re: [webpy] web.py' net.py
Am 11.02.2012 08:50, schrieb Primoz Anzur:
> Maybe you've wanted Image.frombuffer() or Image.fromstring()?

I tried, but to "convert" a File Object to an Image - File Object i read
to use Image.open(file).

I dont want to use tmp_file or write it to disk, because i use GridFS to
store Files.

--
Mit freundlichen Gr en

Patrick Erdmann

XMPP/Mail: patr...@perdmann.de


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Patrick  
View profile  
 More options Feb 13 2012, 4:41 pm
From: Patrick <perdmann...@googlemail.com>
Date: Mon, 13 Feb 2012 22:41:07 +0100
Local: Mon, Feb 13 2012 4:41 pm
Subject: Re: [webpy] web.py' net.py
f is image data, see here:

x = web.input(bilder={})
b.set_image(x.bilder.file)
----
f = x.bilder.file
----

And the failure happens in

/web/net.py

Am 09.02.2012 16:23, schrieb Primoz Anzur:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Primoz Anzur  
View profile  
 More options Feb 14 2012, 4:04 am
From: Primoz Anzur <stormchas...@gmail.com>
Date: Tue, 14 Feb 2012 10:04:36 +0100
Local: Tues, Feb 14 2012 4:04 am
Subject: Re: [webpy] web.py' net.py

Can we get the relevant backtrace, please?

On Mon, Feb 13, 2012 at 10:41 PM, Patrick <perdmann...@googlemail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Primoz Anzur  
View profile  
 More options Feb 14 2012, 6:17 am
From: Primoz Anzur <stormchas...@gmail.com>
Date: Tue, 14 Feb 2012 12:17:35 +0100
Local: Tues, Feb 14 2012 6:17 am
Subject: Re: [webpy] web.py' net.py

Wait a tick.
Why do you actually need PIL? Why not just directly store into the GridFS?
If you need image manipulation, then you have no choice but to use PIL's
handling.
You could do something like this:

img = Image.fromstring(f.read())
<do things that needed to be done>
write_image_into_database_thingy(img.tostring("jpeg")) #I think, that this
should be enough.

That's about it.

The upload part will give you tmp_file, whether you like it or not,
anyways. That's how uploads work.

On Mon, Feb 13, 2012 at 3:27 PM, Patrick Erdmann <patr...@perdmann.de>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Patrick Erdmann  
View profile  
 More options Feb 28 2012, 5:14 am
From: Patrick Erdmann <patr...@perdmann.de>
Date: Tue, 28 Feb 2012 11:14:18 +0100
Local: Tues, Feb 28 2012 5:14 am
Subject: Re: [webpy] web.py' net.py

I found out why it dosnt work ... web.py dont like to call validates on
bytecode!

Thanks for your help!

Am 14.02.2012 12:17, schrieb Primoz Anzur:

--
Mit freundlichen Gr en

Patrick Erdmann

XMPP/Mail: patr...@perdmann.de


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Primoz Anzur  
View profile  
 More options Feb 28 2012, 10:04 am
From: Primoz Anzur <stormchas...@gmail.com>
Date: Tue, 28 Feb 2012 16:04:13 +0100
Local: Tues, Feb 28 2012 10:04 am
Subject: Re: [webpy] web.py' net.py

That's the relevant part of the code you didn't post :]

On Tue, Feb 28, 2012 at 11:14 AM, Patrick Erdmann <patr...@perdmann.de>wrote:

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »