HTMLParser can't read japanese

2010-04-13 Thread Dodo
Here's a small script to generate again the error running windows 7 with python 3.1 FILE : parseShift.py import urllib.request as url from html.parser import HTMLParser class myParser(HTMLParser): def handle_starttag(self, tag, attrs): print("Start of %s tag : %s" % (tag

Re: HTMLParser can't read japanese

2010-04-13 Thread Dodo
alright, it's just because of Windows cmd in IDLE it works fine any workaround? Dorian Le 13/04/2010 13:40, Dodo a écrit : Here's a small script to generate again the error running windows 7 with python 3.1 FILE : parseShift.py import urllib.request as url from html.parser import

Why this exception catch doesn't work?? (python 3)

2010-04-20 Thread Dodo
Hello, I don't understand why this won't execute import urllib.request as u import socket socket.setdefaulttimeout(10) l = "http://img144.imageshack.us/my.php?image=koumakandg8.jpg"; # supposed to timeout try: h = u.urlretrieve(l) except u.URLError, e: # I tried u.e too, no effect.

Re: Why this exception catch doesn't work?? (python 3)

2010-04-20 Thread Dodo
Le 20/04/2010 13:06, MRAB a écrit : Dodo wrote: Hello, I don't understand why this won't execute import urllib.request as u import socket socket.setdefaulttimeout(10) l = "http://img144.imageshack.us/my.php?image=koumakandg8.jpg"; # supposed to timeout try: h = u.u

chr(i) ASCII under Python 3

2010-04-26 Thread Dodo
Hi all, Under python 2.6, chr() "Return a string of one character whose ASCII code is the integer i." (quoted from docs.python.org) Under python 3.1, chr() "Return the string of one character whose Unicode codepoint is the integer i." I want to convert a ASCII code back to a character under py

Re: chr(i) ASCII under Python 3

2010-04-26 Thread Dodo
Le 26/04/2010 22:26, Alf P. Steinbach a écrit : On 26.04.2010 22:12, * Dodo: Hi all, Under python 2.6, chr() "Return a string of one character whose ASCII code is the integer i." (quoted from docs.python.org) Under python 3.1, chr() "Return the string of one character whose Unico

CGI python 3 write RAW BINARY

2010-04-28 Thread Dodo
Help! this is driving me crazy lol I want to print raw binary data to display an image file BUT python3 outputs b'' instead of so the browser can't read the image!! f = open("/some/path/%s" % x, 'rb') print(f.read()) any idea? Dorian -- http://mail.python.org/mailman/listinfo/python-l

Re: CGI python 3 write RAW BINARY

2010-04-29 Thread Dodo
Le 29/04/2010 01:45, Antoine Pitrou a écrit : Le Wed, 28 Apr 2010 23:54:07 +0200, Dodo a écrit : Help! this is driving me crazy lol I want to print raw binary data to display an image file BUT python3 outputs b'' instead of so the browser can't read the image!! f = open

Re: CGI python 3 write RAW BINARY

2010-04-29 Thread Dodo
Le 29/04/2010 17:07, Antoine Pitrou a écrit : Le Thu, 29 Apr 2010 12:53:53 +0200, Dodo a écrit : @Antoine : It not sys.stdout.buffer.write but sys.stdout.write() instead. But it still doesn't work, now I have empty content Let me insist: please use sys.stdout.buffer.write(). You'll

Re: Python's regular expression help

2010-04-29 Thread Dodo
Le 29/04/2010 20:00, goldtech a écrit : Hi, Trying to start out with simple things but apparently there's some basics I need help with. This works OK: import re p = re.compile('(ab*)(sss)') m = p.match( 'absss' ) m.group(0) 'absss' m.group(1) 'ab' m.group(2) 'sss' ... But two questions: Ho

Re: CGI python 3 write RAW BINARY

2010-04-29 Thread Dodo
Le 29/04/2010 22:21, Antoine Pitrou a écrit : Le Thu, 29 Apr 2010 18:33:08 +0200, Dodo a écrit : Oh, I tested on my windows machine avec sys.stdout.buffer.write() didn't work. I just tested on my linux server, and it works So, let's modify

Re: CGI python 3 write RAW BINARY

2010-04-29 Thread Dodo
Le 29/04/2010 18:33, Dodo a écrit : Le 29/04/2010 17:07, Antoine Pitrou a écrit : Le Thu, 29 Apr 2010 12:53:53 +0200, Dodo a écrit : @Antoine : It not sys.stdout.buffer.write but sys.stdout.write() instead. But it still doesn't work, now I have empty content Let me insist: pleas

Re: CGI python 3 write RAW BINARY

2010-05-01 Thread Dodo
Le 30/04/2010 17:52, Antoine Pitrou a écrit : Le Thu, 29 Apr 2010 23:37:32 +0200, Dodo a écrit : I don't get a thing. Now with the fix : All browsers shows a different thing, but not the image! http://ddclermont.homeip.net/misc/python/ If I save it to computer : * Windows image v

Re: CGI python 3 write RAW BINARY

2010-05-07 Thread Dodo
Le 01/05/2010 12:52, Dodo a écrit : Le 30/04/2010 17:52, Antoine Pitrou a écrit : Le Thu, 29 Apr 2010 23:37:32 +0200, Dodo a écrit : I don't get a thing. Now with the fix : All browsers shows a different thing, but not the image! http://ddclermont.homeip.net/misc/python/ If I save

Python3 buffer extra byte??

2010-05-17 Thread Dodo
Let's consider this code: #!/usr/bin/python3 import cgi, sys print("Content-type:image/jpeg\n\n") f = open("img.jpg","rb") sys.stdout.flush() sys.stdout.buffer.write( f.read() ) f.close() I receive the file with one padding byte at the start of the file (0x0a) http://www.1pix.org/multi/images/wg

Tkinter help - Why this behavior ? (py3)

2010-06-05 Thread Dodo
Hi, let's consider this exemple : from tkinter import * from tkinter.ttk import * class First: def __init__(self): self.root = Tk() B = Button(self.root, command=self.op) B.pack() self.root.mainloop()

Re: Tkinter help - Why this behavior ? (py3)

2010-06-07 Thread Dodo
Le 05/06/2010 19:07, Alf P. Steinbach a écrit : * Dodo, on 05.06.2010 15:46: Hi, let's consider this exemple : from tkinter import * from tkinter.ttk import * class First: def __init__(self): self.root = Tk() B = Button(self.root, command=self.op) B.pack() self.root.mainloop() def op

Re: Tkinter help - Why this behavior ? (py3)

2010-06-09 Thread Dodo
Le 07/06/2010 15:26, Alf P. Steinbach a écrit : * Dodo, on 07.06.2010 12:38: Le 05/06/2010 19:07, Alf P. Steinbach a écrit : * Dodo, on 05.06.2010 15:46: Hi, let's consider this exemple : from tkinter import * from tkinter.ttk import * class First: def __init__(self): self.root = T

[py3] Tkinter menu checkbutton not working

2010-06-09 Thread Dodo
Hello, I trying to make this piece of code work (this is python3) from tkinter import * from tkinter.ttk import * class Window: def __init__(self): self.root = Tk() self.menu = Menu(self.root) self.root['menu'] = self.menu self.submenu = Menu(self.menu) self.ck = 0 self.submenu.a

Re: Tkinter help - Why this behavior ? (py3)

2010-06-09 Thread Dodo
Le 09/06/2010 18:49, rantingrick a écrit : On Jun 5, 8:46 am, Dodo wrote: Hi, let's consider this exemple : from tkinter import * from tkinter.ttk import * class First: def __init__(self): self.root = Tk() B = Button(self.root, command=se

Re: Tkinter menu checkbutton not working

2010-06-09 Thread Dodo
Le 09/06/2010 18:54, rantingrick a écrit : On Jun 9, 11:26 am, Dodo wrote: Hello, I trying to make this piece of code work (this is python3) from tkinter import * from tkinter.ttk import * class Window: def __init__(self): self.root = Tk() self.menu = Menu(self.root

Re: Tkinter help - Why this behavior ? (py3)

2010-06-09 Thread Dodo
Le 09/06/2010 19:13, Dodo a écrit : Le 09/06/2010 18:49, rantingrick a écrit : On Jun 5, 8:46 am, Dodo wrote: Hi, let's consider this exemple : from tkinter import * from tkinter.ttk import * class First: def __init__(self): self.root = Tk() B = Button(self.root, command=self.op) B

Re: Tkinter menu checkbutton not working

2010-06-12 Thread Dodo
Le 09/06/2010 20:37, rantingrick a écrit : On Jun 9, 12:20 pm, Dodo wrote: Le 09/06/2010 18:54, rantingrick a crit : On Jun 9, 11:26 am, Dodowrote: Hello, I trying to make this piece of code work (this is python3) from tkinter import * from tkinter.ttk import * class Window

Django 1.2.1 - stuck with CSRF verification

2010-08-19 Thread Dodo
Hi all, I followed the tutorial but at page 4 I can't get rid of CSRF errors, even though I followed everything in this page : http://docs.djangoproject.com/en/dev/ref/contrib/csrf/ Any idea? Dorian -- http://mail.python.org/mailman/listinfo/python-list

Re: Django 1.2.1 - stuck with CSRF verification

2010-08-19 Thread Dodo
Le 19/08/2010 20:40, Thomas Jollans a écrit : On Thursday 19 August 2010, it occurred to Dodo to exclaim: Hi all, I followed the tutorial but at page 4 I can't get rid of CSRF errors, even though I followed everything in this page : http://docs.djangoproject.com/en/dev/ref/contrib/csrf/