Re: how to get text from a html file?

2010-04-13 Thread Stefan Behnel
rake, 14.04.2010 02:45: On Apr 13, 2:12 pm, Chris Colbert wrote: You should look into beautiful soup http://www.crummy.com/software/BeautifulSoup/ For more complex parsing beautiful soup is definitely the way to go. Why would a library that even the author has lost interest in be "the way

Re: mailbox multipart

2010-04-13 Thread Tim Roberts
janwillem wrote: > >I am trying to analyze mailboxes using an iterator: >for key, message in mbox.iteritems(): > >When message is a simple mail message['date'] results the date. >When, however, it is a multipart message this results in None. How can >you full proof get the "date", "from" and

Re: Does Abstract class , interfaces there in python ?

2010-04-13 Thread Chris Rebert
On Tue, Apr 13, 2010 at 10:57 PM, gopi krishna wrote: > Hi , >  I want to know whether there is an abstract class and interfaces in python. Sort of: http://docs.python.org/library/abc.html Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list

Does Abstract class , interfaces there in python ?

2010-04-13 Thread gopi krishna
Hi , I want to know whether there is an abstract class and interfaces in python. If so how to implement it.. Pls help me on this. Thanks Gopi -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating a standalone application

2010-04-13 Thread Gabriel Genellina
En Tue, 13 Apr 2010 18:02:07 -0300, Luis Quesada escribió: I am getting an "expected string without null bytes" error when using cxfreeze for creating a standalone application (in Linux-Ubuntu). None of my files has null bytes. Are you sure? A text file saved as, e.g., UTF-16, does conta

Re: when should I explicitely close a file?

2010-04-13 Thread Ryan Kelly
On Tue, 2010-04-13 at 18:19 -0700, Chris Rebert wrote: > On Tue, Apr 13, 2010 at 5:45 PM, Giampaolo Rodola' wrote: > > What about open('foo', 'w').close(). > > Does it have the same problems? > > Well, no, but that's only because it's a pointless no-op that doesn't > really do anything besides po

Re: when should I explicitely close a file?

2010-04-13 Thread Dave Angel
gelonida wrote: Hi, I've been told, that following code snippet is not good. open("myfile","w").write(astring) , because I'm neither explicitely closing nor using the new 'with' syntax. What exactly is the impact of not closing the file explicitely (implicitley with a 'with' block)? Even w

Re: when should I explicitely close a file?

2010-04-13 Thread Chris Rebert
On Tue, Apr 13, 2010 at 5:45 PM, Giampaolo Rodola' wrote: > What about open('foo', 'w').close(). > Does it have the same problems? Well, no, but that's only because it's a pointless no-op that doesn't really do anything besides possibly throwing an exception (e.g. if the script didn't have write

Re: when should I explicitely close a file?

2010-04-13 Thread Giampaolo Rodola'
What about open('foo', 'w').close(). Does it have the same problems? --- Giampaolo http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil -- http://mail.python.org/mailman/listinfo/python-list

Re: how to get text from a html file?

2010-04-13 Thread rake
On Apr 13, 2:12 pm, Chris Colbert wrote: > On Tue, Apr 13, 2010 at 1:58 PM, varnikat t wrote: > > > Hi, > > Can anyone tell me how to get text from a html file?I am trying to display > > the text of an html file in textview(of glade).If i directly display the > > file,it shows with html tags and

Re: when should I explicitely close a file?

2010-04-13 Thread Steven D'Aprano
On Tue, 13 Apr 2010 15:01:25 -0700, gelonida wrote: > Hi, > > > I've been told, that following code snippet is not good. > > > open("myfile","w").write(astring) , because I'm neither explicitely > closing nor using the new 'with' syntax. > > What exactly is the impact of not closing the file

Re: when should I explicitely close a file?

2010-04-13 Thread Chris Rebert
On Tue, Apr 13, 2010 at 3:01 PM, gelonida wrote: > Hi, > > I've been told, that following code snippet is not good. > > open("myfile","w").write(astring) , because I'm neither explicitely > closing nor using the new 'with' syntax. > > What exactly is the impact of not closing the file explicitely

Re: Creating a standalone application

2010-04-13 Thread Luis Quesada
Lawrence D'Oliveiro wrote: In message , Luis Quesada wrote: I am getting an "expected string without null bytes" error when using cxfreeze for creating a standalone application (in Linux-Ubuntu). Why bother? Every decent Linux system will have Python available. Why not just distribute it as

when should I explicitely close a file?

2010-04-13 Thread gelonida
Hi, I've been told, that following code snippet is not good. open("myfile","w").write(astring) , because I'm neither explicitely closing nor using the new 'with' syntax. What exactly is the impact of not closing the file explicitely (implicitley with a 'with' block)? Even with my example I'd

mailbox multipart

2010-04-13 Thread janwillem
I am trying to analyze mailboxes using an iterator: for key, message in mbox.iteritems(): When message is a simple mail message['date'] results the date. When, however, it is a multipart message this results in None. How can you full proof get the "date", "from" and "to" of of a multipart mai

Re: Creating a standalone application

2010-04-13 Thread Lawrence D'Oliveiro
In message , Luis Quesada wrote: > I am getting an "expected string without null bytes" error when using > cxfreeze for creating a standalone application (in Linux-Ubuntu). Why bother? Every decent Linux system will have Python available. Why not just distribute it as a script? -- http://mail.p

Creating a standalone application

2010-04-13 Thread Luis Quesada
Dear all, I am getting an "expected string without null bytes" error when using cxfreeze for creating a standalone application (in Linux-Ubuntu). None of my files has null bytes. I also tried pyinstaller but I got the error attached at the end. My program runs fine when executed from eclipse.

Re: packaging multiple python scripts as Windows exe file

2010-04-13 Thread Joaquin Abian
On Apr 13, 9:56 pm, Mike Driscoll wrote: > On Apr 12, 5:20 pm, Alex Hall wrote: > > > > > Hi all, > > While my project is still suffering from major import problems, I will > > soon have to try to package it as a Windows executable file. I do not > > want an installer; I want the user to be able

Compiling Python extension modules in the near future, was: Re: Download Visual Studio Express 2008 now

2010-04-13 Thread Irmen de Jong
On 12-4-2010 22:36, Martin v. Loewis wrote: If you are planning to build Python extension modules in the next five years, I recommend that you obtain a copy of VS Express, just in case Microsoft removes it from their servers. Thanks for the idea Martin. However I've changed the post title a li

Re: Constructing an if statement from the client data in python

2010-04-13 Thread Vishal Rana
Thanks Chris On Tue, Apr 13, 2010 at 1:08 PM, Chris Rebert wrote: > > On Tue, Apr 13, 2010 at 12:29 PM, Chris Rebert > wrote: > >> On Tue, Apr 13, 2010 at 8:56 AM, Vishal Rana > wrote: > >> > Hi, > >> > > >> > I need to construct an if statement from the data coming from the > client > >> > as

Re: Constructing an if statement from the client data in python

2010-04-13 Thread Chris Rebert
> On Tue, Apr 13, 2010 at 12:29 PM, Chris Rebert wrote: >> On Tue, Apr 13, 2010 at 8:56 AM, Vishal Rana wrote: >> > Hi, >> > >> > I need to construct an if statement from the data coming from the client >> > as >> > below: >> > >> > conditions: condition1, condition2, condition3, condition4 logic

Re: packaging multiple python scripts as Windows exe file

2010-04-13 Thread Mike Driscoll
On Apr 12, 5:20 pm, Alex Hall wrote: > Hi all, > While my project is still suffering from major import problems, I will > soon have to try to package it as a Windows executable file. I do not > want an installer; I want the user to be able to run the program for > as long as they want, then to qui

Re: Constructing an if statement from the client data in python

2010-04-13 Thread Vishal Rana
They are bitwise operators! -- http://mail.python.org/mailman/listinfo/python-list

Re: Download Visual Studio Express 2008 now

2010-04-13 Thread Michel Claveau - MVP
Hi! Thanks for this idea. Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: A 'foolproof' way to query inheritance tree? numbers.Real in 2.6)

2010-04-13 Thread Chris Rebert
On Tue, Apr 13, 2010 at 12:15 PM, Hans Mulder wrote: > Steven D'Aprano wrote: >> Given a class C, is there some way to find out what classes >> issubclass(C, X) will return true for? Obviously you can get a partial >> list, by walking the MRO, but is there a list somewhere of which ABCs >> conside

Re: Constructing an if statement from the client data in python

2010-04-13 Thread Chris Rebert
On Tue, Apr 13, 2010 at 8:56 AM, Vishal Rana wrote: > Hi, > > I need to construct an if statement from the data coming from the client as > below: > > conditions: condition1, condition2, condition3, condition4 logical > operators: lo1, lo2, lo3 (Possible values: "and" "or") > > Eg. > > if conditio

Re: A 'foolproof' way to query inheritance tree? numbers.Real in 2.6)

2010-04-13 Thread Hans Mulder
Steven D'Aprano wrote: Given a class C, is there some way to find out what classes issubclass(C, X) will return true for? Obviously you can get a partial list, by walking the MRO, but is there a list somewhere of which ABCs consider C a subclass? Presumably the general answer is No, because

RE: Python-list Digest, Vol 79, Issue 108

2010-04-13 Thread angelaeyes
I wish to unsubscribe with immediate effect!!! From: python-list-requ...@python.org To: python-list@python.org Sent: Tue Apr 13 17:56:06 SAST 2010 Subject: Python-list Digest, Vol 79, Issue 108 -- http://mail.python.org/mailman/listinfo/python-list-- http://mail.python.org/mailman/listinfo/pyth

RE: Python, CGI and Sqlite3

2010-04-13 Thread Ahmed, Shakir
-Original Message- From: python-list-bounces+shahmed=sfwmd@python.org [mailto:python-list-bounces+shahmed=sfwmd@python.org] On Behalf Of Tim Chase Sent: Tuesday, April 13, 2010 2:36 PM To: Majdi Sawalha Cc: python-list@python.org Subject: Re: Python, CGI and Sqlite3 On 04/13/2010 1

Re: Constructing an if statement from the client data in python

2010-04-13 Thread Vishal Rana
They are bitwise operators! Thanks Vishal Rana -- http://mail.python.org/mailman/listinfo/python-list

Re: Constructing an if statement from the client data in python

2010-04-13 Thread Vishal Rana
They are bitwise operators! Thanks Vishal Rana -- http://mail.python.org/mailman/listinfo/python-list

Re: Python, CGI and Sqlite3

2010-04-13 Thread Tim Chase
On 04/13/2010 12:41 PM, Majdi Sawalha wrote: import sqlite3 statement? and it gives the following error ImportError: No module named sqlite3, i tried it on python shell and all statements are work well. A couple possible things are happening but here are a few that pop to mind: 1) you're r

Re: HTMLParser can't read japanese

2010-04-13 Thread John Nagle
Yes. Try "cmd /u" to get a Unicode console. HTMLparser should already have converted from Shift-JIS to Unicode, so the "print" is outputting Unicode. John Nagle Stefan Behnel wrote: Dodo, 13.04.2010 13:40: Here's a small script to generate again the erro

Re: how to get text from a html file?

2010-04-13 Thread Stefan Behnel
varnikat t, 13.04.2010 19:58: Can anyone tell me how to get text from a html file?I am trying to display the text of an html file in textview(of glade).If i directly display the file,it shows with html tags and attributes, etc. in textview.I don't want that.I just want the text. Can someone help

Re: how to get text from a html file?

2010-04-13 Thread Grant Edwards
On Tue, Apr 13, 2010 at 1:58 PM, varnikat t wrote: > Can anyone tell me how to get text from a html file?I am trying to display > the text of an html file in textview(of glade).If i directly display the > file,it shows with html tags and attributes, etc. in textview.I don't want > that.I just wa

Re: how to get text from a html file?

2010-04-13 Thread Chris Colbert
On Tue, Apr 13, 2010 at 1:58 PM, varnikat t wrote: > > Hi, > Can anyone tell me how to get text from a html file?I am trying to display > the text of an html file in textview(of glade).If i directly display the > file,it shows with html tags and attributes, etc. in textview.I don't want > that.I j

how to get text from a html file?

2010-04-13 Thread varnikat t
Hi, Can anyone tell me how to get text from a html file?I am trying to display the text of an html file in textview(of glade).If i directly display the file,it shows with html tags and attributes, etc. in textview.I don't want that.I just want the text. Can someone help me with this? Regards Varn

Re: Constructing an if statement from the client data in python

2010-04-13 Thread Terry Reedy
On 4/13/2010 11:56 AM, Vishal Rana wrote: Hi, I need to construct an if statement from the data coming from the client as below: conditions: condition1, condition2, condition3, condition4 logical operators: lo1, lo2, lo3 (Possible values: "and" "or") Eg. |if condition1 lo1 condition2 lo3 con

Python, CGI and Sqlite3

2010-04-13 Thread Majdi Sawalha
Dear list members, I am writing CGI program that reads a text feild and uses with select statement to retrieve data from a database file using sqlite3. the program behaived very strange as it does not recognizes the import sqlite3 statement? and it gives the following error ImportError: No mo

Re: curious about python version numbers

2010-04-13 Thread Terry Reedy
On 4/13/2010 9:54 AM, Alex Hall wrote: Thanks, everyone, for the answers! I am still on 2.6 since so many packages rely on it. I got 3.1 at first, but I could not get much to work with it so I installed 2.6 and have only found one package which refuses to work, instead of a lot of them. 2.7, no

Re: Handling quotes in xml.dom text nodes

2010-04-13 Thread Chaim Krause
Stefan, Thank you. The reason that I am using xml.dom.minidom is that I am restricted to a stock RHEL5 stack. That means 2.4 with nothing added. (Welcome to US Army IT !!!) But, I figured out that I need to back up from xml.dom.minidom to xml.dom and then I can use createCDATASection and get what

Re: Handling quotes in xml.dom text nodes

2010-04-13 Thread Stefan Behnel
Chaim Krause, 13.04.2010 17:26: I am building a web page (HTML 4.01 Transitional) using xml.dom.minidom. I have created a

Re: Constructing an if statement from the client data in python

2010-04-13 Thread Benjamin Kaplan
All the operators are available as functions in the operator module. Just use a dict to select the correct function. import operator ops = {"and": operator.and_, "or": operator.or_} op1 = ops[lo1] op3 = ops[lo3] if op3( op1( condition1, condition2), condition4) : #do something On Tue, A

Re: Code dojo on Thursday?

2010-04-13 Thread MRAB
Tim Golden wrote: On 13/04/2010 14:50, John Maclean wrote: Is there a code Dojo in London on Thurs? I've requested two places but have not heard a reply yet. It's usually the first Thursday in the month. I've not heard about one this Thursday. (Doesn't mean I'm right, of course). It looks li

Constructing an if statement from the client data in python

2010-04-13 Thread Vishal Rana
Hi, I need to construct an if statement from the data coming from the client as below: conditions: condition1, condition2, condition3, condition4 logical operators: lo1, lo2, lo3 (Possible values: "and" "or") Eg. if condition1 lo1 condition2 lo3 condition4: # Do something I can think of ev

Re: Handling quotes in xml.dom text nodes

2010-04-13 Thread Chaim Krause
I am looking to find the best answer to my question, but in the mean time I have resorted to monkey patching. def _write_data_no_quote(writer, data): "Writes datachars to writer." data = data.replace("&", "&").replace("<", "<") data = data.replace(">", ">") writer.write(data) mini

Handling quotes in xml.dom text nodes

2010-04-13 Thread Chaim Krause
I am building a web page (HTML 4.01 Transitional) using xml.dom.minidom. I have created a

Re: Code dojo on Thursday?

2010-04-13 Thread Tim Golden
On 13/04/2010 14:50, John Maclean wrote: Is there a code Dojo in London on Thurs? I've requested two places but have not heard a reply yet. It's usually the first Thursday in the month. I've not heard about one this Thursday. (Doesn't mean I'm right, of course). TJG -- http://mail.python.org

Re: Unit testing errors (testing the platform module)

2010-04-13 Thread J. Cliff Dyer
The problem is that the class of platform.__builtins__ is a dict, not a string containing the text "". Try replacing line 16 with this: self.assertEqual(type(platform.__builtins__), dict) Cheers, Cliff On Tue, 2010-04-13 at 15:01 +0100, John Maclean wrote: > I normally use languages uni

Re: Unit testing errors (testing the platform module)

2010-04-13 Thread MRAB
John Maclean wrote: I normally use languages unit testing framework to get a better understanding of how a language works. Right now I want to grok the platform module; 1 #!/usr/bin/env python 2 '''a pythonic factor''' 3 import unittest 4 import platform 5 6 class TestPyfactorTestCa

Re: Unit testing errors (testing the platform module)

2010-04-13 Thread Martin P. Hellwig
On 04/13/10 15:01, John Maclean wrote: I normally use languages unit testing framework to get a better understanding of how a language works. Right now I want to grok the platform module; 1 #!/usr/bin/env python 2 '''a pythonic factor''' 3 import unittest 4 import platform 5 6

Re: Unit testing errors (testing the platform module)

2010-04-13 Thread Benjamin Kaplan
On Tue, Apr 13, 2010 at 10:01 AM, John Maclean wrote: > I normally use languages unit testing framework to get a better > understanding of how a language works. Right now I want to grok the > platform module; > > > 1 #!/usr/bin/env python > 2 '''a pythonic factor''' > 3 import unittest > 4 i

Unit testing errors (testing the platform module)

2010-04-13 Thread John Maclean
I normally use languages unit testing framework to get a better understanding of how a language works. Right now I want to grok the platform module; 1 #!/usr/bin/env python 2 '''a pythonic factor''' 3 import unittest 4 import platform 5 6 class TestPyfactorTestCase(unittest.TestCase):

Re: Generating a rainbow?

2010-04-13 Thread Giacomo Boffi
Tobiah writes: > I'm having a difficult time with this. I want > to display a continuous range of hues using HTML > hex representation (#RRGGBB). How would I go > about scanning through the hues in order to > make a rainbow? if you mean real rainbows when you say "rainbow", as rainbows go fro

Re: curious about python version numbers

2010-04-13 Thread Alex Hall
Thanks, everyone, for the answers! I am still on 2.6 since so many packages rely on it. I got 3.1 at first, but I could not get much to work with it so I installed 2.6 and have only found one package which refuses to work, instead of a lot of them. On 4/13/10, Shashwat Anand wrote: > It is like r

Code dojo on Thursday?

2010-04-13 Thread John Maclean
Is there a code Dojo in London on Thurs? I've requested two places but have not heard a reply yet. -- John Maclean MSc. (DIC) Bsc. (Hons),Core Linux Systems Engineering,07739 171 531 -- http://mail.python.org/mailman/listinfo/python-list

Error using httlib's HTTPSConnection with PKCS#12 certificate

2010-04-13 Thread Rémi
I'm trying to use httplib's HTTPSConnection for client validation, using a PKCS #12 certificate. I know the certificate is good, as I can connect to the server using it in MSIE and Firefox. Here's my connect function (the certificate includes the private key). I've pared it down to just the basi

Re: HTMLParser can't read japanese

2010-04-13 Thread Stefan Behnel
Dodo, 13.04.2010 13:40: 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"

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 HTMLParser

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

DjangoCon Europe - 24. - 26.5.2010 in Berlin

2010-04-13 Thread Markus Zapke-Gründemann
DjangoCon Europe[1] is a Django[2] conference that aims to bring together the community and provide a wide range of sessions, panels, lightning talks and showcases of Django usage within various businesses. We aim to educate and bring people together to turn new ideas into working code! The c

Re: Tough sorting problem: or, I'm confusing myself

2010-04-13 Thread david jensen
On Apr 12, 1:22 am, Paul McGuire wrote: > On Apr 9, 10:03 am, david jensen wrote: > > > > > Hi all, > > > I'm trying to find a good way of doing the following: > > > Each n-tuple in combinations( range( 2 ** m ), n ) has a corresponding > > value n-tuple (call them "scores" for clarity later). I'

Re: Tough sorting problem: or, I'm confusing myself

2010-04-13 Thread david jensen
On Apr 11, 9:39 pm, Raymond Hettinger wrote: > The overall algorithm looks about right. > The inner-loop could be tighted-up a bit. > And you could replace the outer sort with a heap. > > best2 = {} > for i in itertools.combinations(range( 2**m), n-1): >     scorelist = [] >     for j in range( 2

Re: curious about python version numbers

2010-04-13 Thread Ben Finney
Alex Hall writes: > I am just curious: if Python3.x is already out, why is 2.7 being > released? Are there two main types of Python? Python 3.x brings improvements that break backward compatibility: Python 3.0 (a.k.a. "Python 3000" or "Py3k") is a new version of the language that is inc

Re: curious about python version numbers

2010-04-13 Thread Shashwat Anand
It is like releasing window Xp SP3 even if Vista is out. The problem is we should start using python 3.x but many application like django, twisted had not migrated yet. Hence this stuff to support 2.x . 2.7 is the last 2.x version, no more. On Tue, Apr 13, 2010 at 2:28 PM, Alf P. Steinbach wrote

Re: curious about python version numbers

2010-04-13 Thread Alf P. Steinbach
* Alex Hall: Hi all, I am just curious: if Python3.x is already out, why is 2.7 being released? Are there two main types of Python? Thanks. Old code and old programming habits may work as-is with 2.7 but not with a 3.x implementation. So yes, there are two main extant variants of Python, 2.x

Re: curious about python version numbers

2010-04-13 Thread Xavier Ho
Hi Alex, It's because Python 3.x introduced a lot of backwards incompatibilities. Python 2.7 aims to bridge that gap, so many 3rd party libraries that depend on Python 2.x can transit onto Python 3.x better, as I understand. Cheers, Xav On Mon, Apr 12, 2010 at 12:52 PM, Alex Hall wrote: > Hi

packaging multiple python scripts as Windows exe file

2010-04-13 Thread Alex Hall
Hi all, While my project is still suffering from major import problems, I will soon have to try to package it as a Windows executable file. I do not want an installer; I want the user to be able to run the program for as long as they want, then to quit (by using a command from inside the program) a

curious about python version numbers

2010-04-13 Thread Alex Hall
Hi all, I am just curious: if Python3.x is already out, why is 2.7 being released? Are there two main types of Python? Thanks. -- Have a great day, Alex (msg sent from GMail website) mehg...@gmail.com; http://www.facebook.com/mehgcap -- http://mail.python.org/mailman/listinfo/python-list

Seg fault when launching my module through my C/C++ application

2010-04-13 Thread Maxime Boure
Hello everyone, I made a small python module to command NetworkManager and get some signals from it. My script works well alone, but when I launch it from my C/C++ program it crashes at a certain function (here iface.GetDevices). Here is the function that crashes and next my gdb print *def get_d

!!! Kausha-s very HOT kiss scene.avi !!!

2010-04-13 Thread "Lou " Shy Amateur Strips
!!! Kausha-s very HOT kiss scene.avi !!! http://sites.google.com/site/hifiprofile/ http://sites.google.com/site/hifiprofile/ <<< EXTREME HOT GALLERIES >>> http://sites.google.com/site/hifiprofile/ -- http://mail.python.org/mailman/listinfo/python-list