On 04/20/2012 11:06 PM, Diego Manenti Martins wrote:
> On Fri, Apr 20, 2012 at 11:09 PM, Dave Angel <d...@davea.name> wrote:
>> You forgot to include the list in your response.  I don't normally
>> respond to private messages, but I'll make an exception.
> Sorry about that and thanks.
>
>>> On 04/20/2012 06:47 PM, Diego Manenti Martins wrote:
>>>> Hi.
>>>> Anybody knows the data is sent in a different way for Python 2.5, 2.6
>>>> and 2.7 using this code:
>>>>
>>>>>>> import urllib2
>>>>>>> url = 'http://server.com/post_image?tid=zoV6LJ'
>>>>>>> f = open('test.jpg')
>>>>>>> data = f.read()
>>>>>>> res = urllib2.urlopen(url, data)
>>>> It works the same way for python2.5 and python2.6 but not for python2.7
>>>>
>>>> I checked the sent data with WireShark and it sends the data in a
>>>> different way. I'm not an expert I just see it's different :)
>>>> It might be a server problem although I think the lib should behave
>>>> equals for all versions.
>
>> 1) Don't retype it, copy/paste it.  Far too much time is wasted finding
>> bugs which were just introduced when people compose their emails by
>> retyping stuff.   Post exactly what you ran.
> I copied it. just changed the server name. It's the code I ran and
> works on 2.6 and not on 2.7
> Even don't specifying the 'rb' when open the file, that code works on python 
> 2.6

Then you got lucky.  Might not work with the very next jpeg you try, or
the next OS you're running on.  Oh yeah, I forgot, you never mentioned
(3) what OS you're running on.  If you want the whole file, and you want
it unchanged, better add the 'b'.

>
>> 2) Be specific about what behavior has you bothered.  You say it's
>> "different".  From that I could conclude that in Python 2.6 it prints
>> "April Fool" and in Python 2.7 it blows up your machine.
> The problem is that I don't know what is wrong. I don't have access to
> the server I'm sending data. I just get a server error when running
> the code with python 2.7
> I just wonder if someone get some behavior like this or know if
> something changed on urllib2 and libs that are used on it.
>
> Thank you for your time.
>

4) A new symptom.  You got a server error.  Does the server error have a
number?  Or some text?

You observed something with wireshark.  What was that?  it sends the
data in a different way?  What way is that?



-- 

DaveA

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to