smtpd bug?

2011-02-07 Thread Ben
I've been using smtpd.py to implement a kind of cowboy SMTP server (only overriding process_message), and inevitably after a certain time the server stops accepting incoming connections: the socket on which it was formerly listening gets closed. I ran it using strace and discovered that it would g

Re: PIL Open Problem

2011-02-07 Thread Richard Holmes
On Tue, 08 Feb 2011 10:56:52 +1100, Ben Finney wrote: >Richard Holmes writes: > >> Thanks, Ben. It turns out that I imported both Image and Tkinter and >> Tkinter has an Image class that masked the Image class in the Image >> module. I solved the problem by moving the Image code to a separate >>

Re: PIL Open Problem

2011-02-07 Thread Westley Martínez
On Mon, 2011-02-07 at 15:54 -0800, rantingrick wrote: > On Feb 7, 5:35 pm, Richard Holmes wrote: > > > Thanks, Ben. It turns out that I imported both Image and Tkinter and > > Tkinter has an Image class that masked the Image class in the Image > > module. I solved the problem by moving the Image

Re: Why not "list = ftplib.FTP.dir()" ?

2011-02-07 Thread rantingrick
On Feb 7, 4:48 pm, Ian Kelly wrote: > On Mon, Feb 7, 2011 at 3:26 PM, trylks wrote: > > I don't know if it is ftplib or just me, but something feels terribly wrong > > in this: > > >> from ftplib import FTP > >> from functools import partial > > >> class MyFTP(FTP): > >>   def dir(self): > >>    

Re: PIL Open Problem

2011-02-07 Thread Ben Finney
Richard Holmes writes: > Thanks, Ben. It turns out that I imported both Image and Tkinter and > Tkinter has an Image class that masked the Image class in the Image > module. I solved the problem by moving the Image code to a separate > module This is a classic problem known as “namespace clobber

Re: PIL Open Problem

2011-02-07 Thread rantingrick
On Feb 7, 5:35 pm, Richard Holmes wrote: > Thanks, Ben. It turns out that I imported both Image and Tkinter and > Tkinter has an Image class that masked the Image class in the Image > module. I solved the problem by moving the Image code to a separate > module Yes an another great example of why

Re: Remove whitespaces and line breaks in a XML file

2011-02-07 Thread Josh English
I found the code posted at http://infix.se/2007/02/06/gentlemen-indent-your-xml quite helpful in turning my xml into human-readable structures. It works best for XML-Data. Josh -- http://mail.python.org/mailman/listinfo/python-list

Re: socket.rcv timeout while-loop

2011-02-07 Thread Dwayne Blind
Dear Stephen, Thanks for telling me this all looked very peculiar. As you said, it did not really need solving. Cheers, Dwayne 2011/2/4 Stephen Hansen > On 2/4/11 9:16 AM, Dwayne Blind wrote: > > @ Stephen Hansen > > Now I am pretty much worried. :'( > > Why? This is all sounding like a probl

Re: PIL Open Problem

2011-02-07 Thread Richard Holmes
On Tue, 08 Feb 2011 09:47:32 +1100, Ben Finney wrote: >Richard Holmes writes: > >> I'm trying to create an image for use in Tkinter. If I understand the >> PIL documentation correctly, I first need to import Image, then >> create an instance of the Image class and call 'open' (this according >>

Re: PIL Open Problem

2011-02-07 Thread Ben Finney
Richard Holmes writes: > On Mon, 07 Feb 2011 17:28:45 -0500, Corey Richardson > wrote: > >This is good: > > > >import Image > >im = Image.open(foo) > Uh, thanks, Corey, but that's what I'm doing. See Traceback: Without code, we can't see what you're doing. Please post a minimal working example

Re: PIL Open Problem

2011-02-07 Thread Richard Holmes
On Mon, 07 Feb 2011 17:28:45 -0500, Corey Richardson wrote: >On 02/07/2011 05:27 PM, Richard Holmes wrote: >> I'm trying to create an image for use in Tkinter. If I understand the >> PIL documentation correctly, I first need to import Image, then >> create an instance of the Image class and call

Re: splitting by double newline

2011-02-07 Thread MRAB
On 07/02/2011 21:15, Nikola Skoric wrote: Dana Mon, 7 Feb 2011 10:02:05 -0800 (PST), Ian kaze: self.tables = re.split(r'(?:\r\n){2,}|\r{2,}|\n{2,}', bulk) Thanks! I tried without "?:", but it didn't work. Can you tell me why is it important that group is noncapturing? The scanner uses capt

Re: PIL Open Problem

2011-02-07 Thread Ben Finney
Richard Holmes writes: > I'm trying to create an image for use in Tkinter. If I understand the > PIL documentation correctly, I first need to import Image, then > create an instance of the Image class and call 'open' (this according > to the documentation). When I try to do this using the model i

Re: Why not "list = ftplib.FTP.dir()" ?

2011-02-07 Thread Ian Kelly
On Mon, Feb 7, 2011 at 3:26 PM, trylks wrote: > I don't know if it is ftplib or just me, but something feels terribly wrong > in this: > >> from ftplib import FTP >> from functools import partial >> >> class MyFTP(FTP): >>   def dir(self): >>     l = [] >>     super(MyFTP, self).dir(partial(lambda

Re: PIL Open Problem

2011-02-07 Thread Corey Richardson
On 02/07/2011 05:27 PM, Richard Holmes wrote: > I'm trying to create an image for use in Tkinter. If I understand the > PIL documentation correctly, I first need to import Image, then > create an instance of the Image class and call 'open' Don't do that. This is wrong: import Image im = Image.Ima

Why not "list = ftplib.FTP.dir()" ?

2011-02-07 Thread trylks
I don't know if it is ftplib or just me, but something feels terribly wrong in this: from ftplib import FTP > from functools import partial > > class MyFTP(FTP): > def dir(self): > l = [] > super(MyFTP, self).dir(partial(lambda l, e: l.append(e.split()), l)) > return l > Unfortunate

PIL Open Problem

2011-02-07 Thread Richard Holmes
I'm trying to create an image for use in Tkinter. If I understand the PIL documentation correctly, I first need to import Image, then create an instance of the Image class and call 'open' (this according to the documentation). When I try to do this using the model in the documentation, I get: Trac

Re: splitting by double newline

2011-02-07 Thread Nikola Skoric
Dana Mon, 7 Feb 2011 10:02:05 -0800 (PST), Ian kaze: > self.tables = re.split(r'(?:\r\n){2,}|\r{2,}|\n{2,}', bulk) Thanks! I tried without "?:", but it didn't work. Can you tell me why is it important that group is noncapturing? -- "Now the storm has passed over me I'm left to drift on a dea

Re: Universal Feed Browser problem in feedparser.py

2011-02-07 Thread Miki Tebeka
> >>> import feedparser > >>> d = feedparser.parse("http://feedparser.org/docs/examples/atom10.xml";) This works for me, are you sure it's not a network problem in your side? (what happens if you try to open this link in a browser?) -- http://mail.python.org/mailman/listinfo/python-list

Re: splitting by double newline

2011-02-07 Thread Nikola Skoric
Dana Mon, 07 Feb 2011 19:20:38 +0100, Peter Otten <__pete...@web.de> kaze: > with open(filename, "U") as f: Oh, fabulous. Thanks! -- "Now the storm has passed over me I'm left to drift on a dead calm sea And watch her forever through the cracks in the beams Nailed across the doorways of the bed

Re: Remove whitespaces and line breaks in a XML file

2011-02-07 Thread Stefan Behnel
David Vicente, 07.02.2011 18:45: I´m parsing an xml file with xml.etree. It works correctly, but I have a problem with the text attribute of the elements which should be empty. For example, in this case: Ken The text element of “book” should be empty, but it returns me so

Re: Fully functioning email client in Python

2011-02-07 Thread John Nagle
On 2/5/2011 5:34 PM, iaoua iaoua wrote: What I really need is a ready made fully functional Python client that already has it that offers me a simple interface to extract text from received messages along with a message id that I can use to associate the response to a question with and allows me

Universal Feed Browser problem in feedparser.py

2011-02-07 Thread Virgil Stokes
I am running Python 2.6 on a Windows Vista (32-bit) platform. I recently installed the Universal Feed Parser package (feedparser-5-0). When I try to execute the following commands: >>> import feedparser >>> d = feedparser.parse("http://feedparser.org/docs/examples/atom10.xml";) which is given

Re: Turbogears 2.1 with mako tmplates

2011-02-07 Thread Alice Bevan–McGregor
On 2011-02-07 07:13:43 -0800, Vineet Deodhar said: For web-based solutions, I have started learning TG 2.1 By and large, the documentation on TG 2.1 official site is a work-in-process. As regards to the templates, it tells how to go about Genshi. I wish to go with mako. Gone through the docs of

Re: re.Scanner - match python dot notation

2011-02-07 Thread Christian K.
Am 07.02.11 17:47, schrieb MRAB: On 07/02/2011 15:34, Christian K. wrote: Hi, I am trying to find a regexp to be used with re.Scanner that matches the 'package.module.member' syntax. More specifically I want to parse function strings like numpy.sin(x*a+w) and sort out variables/constants. Th

Re: splitting by double newline

2011-02-07 Thread Peter Otten
Nikola Skoric wrote: > Hello everybody, > > I'd like to split a file by double newlines, but portably. Now, > splitting by one or more newlines is relatively easy: > > self.tables = re.split("[\r\n]+", bulk) > > But, how can I split on double newlines? I tried several approaches, > but none wor

Remove whitespaces and line breaks in a XML file

2011-02-07 Thread David Vicente
Hi, I´m parsing an xml file with xml.etree. It works correctly, but I have a problem with the text attribute of the elements which should be empty. For example, in this case: Ken The text element of “book” should be empty, but it returns me some whitespaces and break li

Re: splitting by double newline

2011-02-07 Thread Ian
On Feb 7, 10:43 am, Nikola Skoric wrote: > Hello everybody, > > I'd like to split a file by double newlines, but portably. Now, > splitting by one or more newlines is relatively easy: > > self.tables = re.split("[\r\n]+", bulk) > > But, how can I split on double newlines? I tried several approache

splitting by double newline

2011-02-07 Thread Nikola Skoric
Hello everybody, I'd like to split a file by double newlines, but portably. Now, splitting by one or more newlines is relatively easy: self.tables = re.split("[\r\n]+", bulk) But, how can I split on double newlines? I tried several approaches, but none worked... -- "Now the storm has passed ov

Re: re.Scanner - match python dot notation

2011-02-07 Thread Peter Otten
Christian K. wrote: > I am trying to find a regexp to be used with re.Scanner that matches the > 'package.module.member' syntax. More specifically I want to parse > function strings like > > numpy.sin(x*a+w) > > and sort out variables/constants. No direct answer, but regarding your ultimate goa

Re: itertools.groupby usage to get structured data

2011-02-07 Thread nn
On Feb 5, 7:12 am, Peter Otten <__pete...@web.de> wrote: > Slafs wrote: > > Hi there! > > > I'm having trouble to wrap my brain around this kind of problem: > > > What I have : > >   1) list of dicts > >   2) list of keys that i would like to be my grouping arguments of > > elements from 1) > >   3

Re: re.Scanner - match python dot notation

2011-02-07 Thread MRAB
On 07/02/2011 15:34, Christian K. wrote: Hi, I am trying to find a regexp to be used with re.Scanner that matches the 'package.module.member' syntax. More specifically I want to parse function strings like numpy.sin(x*a+w) and sort out variables/constants. This one here works using re.match b

Re: returning all matching groups with re.search()

2011-02-07 Thread Mauro Caceres
>>> import re >>> help(re.findall) Help on function findall in module re: findall(pattern, string, flags=0) Return a list of all non-overlapping matches in the string. If one or more groups are present in the pattern, return a list of groups; this will be a list of tuples if the patte

re.Scanner - match python dot notation

2011-02-07 Thread Christian K.
Hi, I am trying to find a regexp to be used with re.Scanner that matches the 'package.module.member' syntax. More specifically I want to parse function strings like numpy.sin(x*a+w) and sort out variables/constants. This one here works using re.match but fails when used with Scanner (due t

Turbogears 2.1 with mako tmplates

2011-02-07 Thread Vineet Deodhar
Hi!, I am a python programmer. For web-based solutions, I have started learning TG 2.1 By and large, the documentation on TG 2.1 official site is a work-in-process. As regards to the templates, it tells how to go about Genshi. I wish to go with mako. Gone through the docs of mako (they are good). B

Re: Are Small Dogs Good with Kids?

2011-02-07 Thread Littlefield, Tyler
Not only does this have -nothing- to do with python, but you reproduced the spam yet again by quoting it... seriously? -- http://mail.python.org/mailman/listinfo/python-list

Re: Are Small Dogs Good with Kids?

2011-02-07 Thread Stefan Behnel
Bob Martin, 07.02.2011 08:19: My two terriers absolutely love children. H, tasty ... Stefan -- http://mail.python.org/mailman/listinfo/python-list