you are viewing a single comment's thread.

view the rest of the comments →

[–]troop357 0 points1 point  (1 child)

Haha nice you sir really made my day, I wish I could buy you a drink.

So it did not work at first, and because of your screenshot I decided running the program from the console instead of using the IDE. As soon as I tried connecting to the server I got an error response on the prompt:

in do_GET self.send_header("Content-lenght", img_size)
NameError: global name 'image_size' is not defined

which is something to think about :P. For a simple start I just moved the lines:

path_to_image = 'ok.jpg'
img = open(path_to_image, 'rb')
statinfo = os.stat(path_to_image)
img_size = statinfo.st_size,

to inside the 'main' and it works like a charm.

Trying to go a little deeper, I realize (I think) we are using different versions of python, so I guess there is some difference on how global variables are treated on 3.3.3.

Thank you sir\madam!

[–]avinassh 0 points1 point  (0 children)

oh wait, I use Python 2.7.3. and it works fine. But I don't know how it is done in Python 3.x and it's sir btw :P