Re: DOM and HTML

2006-04-02 Thread Larry Bates
[EMAIL PROTECTED] wrote: > Hi All, > > I am looking for any Python library which can help to get DOM > tree from HTML. Is there any way to access HTML DOM, just like > accessing it using javascript. > > Any kind of help is appreciated. > > Thanks. > R > Since the browser can't execut

binascii.a2b_binary

2006-04-02 Thread Ed Swarthout
Why is there no binascii.a2b_binary(bitstr) which returns the binary data represented by the bit string? Like: >>> binascii.a2b_binary('0011001100110101') '35' perl has pack("B*", "0011001100110101"); What is the python way to do this? Other fun with strings: >>> ''.decode('hex') '33' >>

Re: Getting a list of all classes derived from a base class

2006-04-02 Thread Alex Martelli
Vijairaj R <[EMAIL PROTECTED]> wrote: ... > class Test: do not use old-style classes: they exist ONLY for backwards compatibility. Make you class Test new-style: class Test(object): ... and you can call Test.__subclasses__() to get a list of all extant subclassed of Test at any time.

Getting a list of all classes derived from a base class

2006-04-02 Thread Vijairaj R
Hi, I have a requirement to findout all the classes that are derived from a single base class. This is how I do it currently. class Test: case = [] class Test1(Test): Test.case.append("Test1") class Test2(Test): Test.case.append("Test2") 1. Is there a better way of doing this. 2. I

Re: "definitive" source on advanced python?

2006-04-02 Thread vdrab
Thank you. The original question was not meant to sound particularly arrogant, and as you point out a book covering ONLY things like metaprogramming would probably be pretty useless in its own way. I have been using python on and off for about a year or so but still find myself staring at some of

Re: DOM and HTML

2006-04-02 Thread Paul Boddie
Larry Bates wrote: > [EMAIL PROTECTED] wrote: > > > > I am looking for any Python library which can help to get DOM > > tree from HTML. Is there any way to access HTML DOM, just like > > accessing it using javascript. [...] > Since the browser can't execute anything except Javascript,

Re: "definitive" source on advanced python?

2006-04-02 Thread Alex Martelli
vdrab <[EMAIL PROTECTED]> wrote: > Hi all, > > Is there some sort of coherent source (dead tree format, maybe?) on > some of the more advanced features > of python (decorators, metaclasses, etc)? I'm sort of looking for a > python book that actually gets to the good stuff at some point, without >

Re: Getting a list of all classes derived from a base class

2006-04-02 Thread Dylan Moreland
Vijairaj R wrote: > Hi, > I have a requirement to findout all the classes that are derived from a > single base class. > > This is how I do it currently. > > class Test: > case = [] > > class Test1(Test): > Test.case.append("Test1") > > class Test2(Test): > Test.case.append("Test2") >

Obtaining the Python Control Flow Graph

2006-04-02 Thread brianlum
Hi, I have been looking for a good way to convert python code into a control flow graph. I know of Python functions that will convert an expression into an abstract syntax tree (i.e. ast = parser.expr('(x+5)*5') then t = ast.totuple() then t), but I am not sure how to obtain a CFG. I've gone thr

Re: print() in Python 3000 return value?

2006-04-02 Thread Martin v. Löwis
bayerj wrote: >> Sorry? 2+2 here returns 4, and certainly should with your Python. > > Err. Never mind. I was thinking about assignments, like > x += 2 > > which returns None. Actually, assignment, in Python, is a statement, not an expression. Statements don't return anything, not even Non

Re: Can I control Video Card by using Python under linux?

2006-04-02 Thread LUK
Thank you! I will try. -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib2 through basic auth'ed proxy

2006-04-02 Thread Alejandro Dubrovsky
John J. Lee wrote: > [EMAIL PROTECTED] (John J. Lee) writes: > >> Alejandro Dubrovsky <[EMAIL PROTECTED]> writes: > [...Alejandro complains about non-working HTTP proxy auth in urllib2...] > > [...John notes urllib2 bug...] >> A workaround is to supply a stupid HTTPPasswordMgr that always return

Re: Assignment in a while?

2006-04-02 Thread Ant
Forget the last suggestion - I wasn't concentrating :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Is pwm Python MegaWidgets viable?

2006-04-02 Thread gregarican
Paul Watson wrote: > Many thanks for your reply. I was setting out to make use of the > Manning book by Grayson. Perhaps I should just use online tutorial and > such for learning plain-old tk first. However, I have heard good things > about the book. Just trying to use what was already at hand

Re: Is pwm Python MegaWidgets viable?

2006-04-02 Thread Paul Watson
gregarican wrote: > Paul Watson wrote: > > >>Does pwm run well on Python 2.4? The last release appears to be in >>2003. The Manning discussion forum is dead. >> >>Is there a better path to learning and producing tkInter apps? >> >> >>Has there been any discussion of wxPython becoming part of th

Re: Doc suggestions (was: Why "class exceptions" are not deprecated?)

2006-04-02 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > > no, but that's because you're the kind of pathetic loser who only sees > > problem with things, and only pops up when you have a chance to piss > > on something. > > Are you going to address the issue, or just limit > yourself to a public temper tantrum? what issue?

Re: python tutorial: popular/informative Python sites ?

2006-04-02 Thread John Salerno
Fredrik Lundh wrote: > the "what now?" page in the tutorial > > http://www.python.org/doc/tut/node14.html > > lists a couple of relevant web sites for Python users, including: > > http://www.python.org > http://starship.python.net > http://www.python.org/pypi > > the starship li

Re: Doc suggestions (was: Why "class exceptions" are not deprecated?)

2006-04-02 Thread Paul Rubin
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > what issue? your inability to contribute anything but complaints? that's > your problem, and you have to fix that yourself. I'm sure you'd feel better > if you tried. I'm not sure what's wrong with complaints. I've submitted a lot of bug reports an

Sending a file to a remote server.

2006-04-02 Thread Jose Carlos Balderas Alberico
Hi. I posted a message in the list a couple of days ago about sending a file to a remote SimpleXMLRPCServer. Well. my doubt still remains, so I come to you again in search of a clearer answer.The thing is I want to send a ZIP file to a server, and what I basically do is enclose the file data into a

Re: Doc suggestions

2006-04-02 Thread rurpy
"Terry Reedy" wrote: > <[EMAIL PROTECTED]> wrote in message > > "Terry Reedy" wrote: > Yes, there have been claims that doc patches have to be in Latex or are > otherwise not welcome. But these mostly (all?) have lacked relevant > concrete data, which would be actual responses to actual submissi

Re: update or refresh a Listbox widget

2006-04-02 Thread Fredrik Lundh
Arne Meissner wrote: > Is there a function to update/refresh a listbox widget. > My one is connected to a database and after a change of the database I would > like the listbox to be updated. Tkinter? the quickest way is to do: w.delete(0, END) w.insert(0, *data) where w is the widget

Re: very very basic question

2006-04-02 Thread Larry Bates
aghazalp wrote: > thanx ...it works great now...you re awesome...the only thing is that > the program only executes once though...I guess I ll have to read up > more anout it but for now that helped me a lot...I appreciated the help > It only executes once because you only call it once. Your pro

Re: very very basic question

2006-04-02 Thread aghazalp
thanx ...it works great now...you re awesome...the only thing is that the program only executes once though...I guess I ll have to read up more anout it but for now that helped me a lot...I appreciated the help -- http://mail.python.org/mailman/listinfo/python-list

Assignment in a while?

2006-04-02 Thread none
Hi all, First, let me preface this by the fact that I'm completely new to the language, but not to programming in general. I'm trying to get my feet wet with something near and dear to my heart: database programming. Here's what I've got: import pgdb; dbh = pgdb.connect(database = 'test') st

Re: Doc suggestions (was: Why "class exceptions" are not deprecated?)

2006-04-02 Thread rurpy
Fredrik Lundh wrote: > no, but that's because you're the kind of pathetic loser who only sees > problem with things, and only pops up when you have a chance to piss > on something. Are you going to address the issue, or just limit yourself to a public temper tantrum? -- http://mail.python.org/ma

Re: very very basic question

2006-04-02 Thread Georg Brandl
aghazalp wrote: > hi guys, > this would be the most basic question ever...I am not a programmer but > I am trying to learn programming in python...I was reading John Zelle's > text book and instructed me to make .py file and save it on the desk > top...then it said close the python GUI and double c

Re: very very basic question

2006-04-02 Thread aghazalp
thanx george for the prompt answer... when you say add a call that means what exactly?...here is the program I was supposed to write...could you tell me what to add where in this program? def main(): print "this program is crazy" x=input ('enter a number betwenen 0 and 1: ') for i rang

Re: print() in Python 3000 return value?

2006-04-02 Thread Georg Brandl
bayerj wrote: > Expressions like > 2 + 2 > > return None, too. Sorry? 2+2 here returns 4, and certainly should with your Python. Georg -- http://mail.python.org/mailman/listinfo/python-list

very very basic question

2006-04-02 Thread aghazalp
hi guys, this would be the most basic question ever...I am not a programmer but I am trying to learn programming in python...I was reading John Zelle's text book and instructed me to make .py file and save it on the desk top...then it said close the python GUI and double click on the icon of the I

Re: very very basic question

2006-04-02 Thread Georg Brandl
aghazalp wrote: > thanx george for the prompt answer... when you say add a call that > means what exactly?...here is the program I was supposed to > write...could you tell me what to add where in this program? > > def main(): > print "this program is crazy" > x=input ('enter a number betwe

Re: print() in Python 3000 return value?

2006-04-02 Thread Atanas Banov
James Thiele wrote: > I noticed in PEP 3000 that print will become a function. The PEP > references a thread where Guido explains this decision. The thread does > not specify what the function will return. Has this been decided? reading the discussion, the arguments are about "print" as of now bei

update or refresh a Listbox widget

2006-04-02 Thread Arne Meissner
Hello! Is there a function to update/refresh a listbox widget. My one is connected to a database and after a change of the database I would like the listbox to be updated. Thank you for your help! Arne -- http://mail.python.org/mailman/listinfo/python-list

Re: Assignment in a while?

2006-04-02 Thread Ant
There are various ways you could do this: If the number of results won't be too big: ... for result in sth.fetchall(): print result If it may be very large: ... result = sth.fetchone() while result: print result result = sth.fetchone() Or perhaps nicer: ... def result_iterator(res

Re: Assignment in a while?

2006-04-02 Thread bill pursell
none wrote: > import pgdb; > > dbh = pgdb.connect(database = 'test') > sth = dbh.cursor() > sth.execute("SELECT * FROM capitals") > #while 1: > #results = sth.fetchone() > #if results == None: > #break > #print results > while results = sth.fetchone(): > print results

Re: Assignment in a while?

2006-04-02 Thread Duncan Booth
none wrote: > If I try to run the above code, I get a SyntaxError indicating that I > can't do an assignment in the while loop. I found a way around this > (see the commented out while loop), but it seems hackish. Assignment > within a while loop seems like a pretty standard thing, so I'm jus

Re: Assignment in a while?

2006-04-02 Thread none
So it seems that I stumbled on the idiomatic way of doing this then. Well, as they say, "When in Rome..." :). Thanks for pointing out the FAQ. I'll be reading up on it. Cheers, Ben Paul Boddie wrote: > none/Ben wrote: > >>Assignment within a while loop seems like a pretty standard thing, so

Re: Assignment in a while?

2006-04-02 Thread Paul Boddie
none/Ben wrote: > > Assignment within a while loop seems like a pretty standard thing, so I'm just > curious what I'm missing. The FAQ on this subject? ;-) http://www.python.org/doc/faq/general/#why-can-t-i-use-an-assignment-in-an-expression It's "standard" in C-flavoured languages, certainly, b

Re: print() in Python 3000 return value?

2006-04-02 Thread bayerj
Expressions like >>> 2 + 2 return None, too. I am not certain, but as far as I know this has some major design reasons. Thus I am certain, that print() will return None also. -- http://mail.python.org/mailman/listinfo/python-list

Re: Assignment in a while?

2006-04-02 Thread Fredrik Lundh
"none <"@bag.python.org> wrote: > So it seems that I stumbled on the idiomatic way of doing this then. > Well, as they say, "When in Rome..." :). Thanks for pointing out the > FAQ. I'll be reading up on it. the idiomatic way to loop in Python is to use iterators/generators. if you have a calla

Re: print() in Python 3000 return value?

2006-04-02 Thread Gary Herron
Felipe Almeida Lessa wrote: >Em Dom, 2006-04-02 às 10:41 -0700, James Thiele escreveu: > > >>Martin chimedin: >> >> >>>James Thiele wrote: >>> >>> I noticed in PEP 3000 that print will become a function. The PEP references a thread where Guido explains this decision. The thread

Re: Credit card API Sol with python interface

2006-04-02 Thread Larry Bates
Sakcee wrote: > Hi > > does anybody know of any credit card merchant slution with python API. > we used to use cybercash long time ago, but are willing to switch to > something good and not pricy. > we want to accept credit cards and process them. > > something with python wrapper will be great ,

Re: print() in Python 3000 return value?

2006-04-02 Thread James Thiele
Martin chimedin: > James Thiele wrote: > > I noticed in PEP 3000 that print will become a function. The PEP > > references a thread where Guido explains this decision. The thread does > > not specify what the function will return. Has this been decided? > > My intuition is that it should be a proce

Re: python tutorial: popular/informative Python sites ?

2006-04-02 Thread Daniel Bickett
I read c.l.py and (the Unofficial) Planet Python (and that's it), so perhaps that's an appropriate suggestion: http://www.planetpython.org/ (From the Starship: "If you want to join the crew, we only require your PSA membership") -- Daniel Bickett dbickett at gmail dot com http://heureusemen

print() in Python 3000 return value?

2006-04-02 Thread James Thiele
I noticed in PEP 3000 that print will become a function. The PEP references a thread where Guido explains this decision. The thread does not specify what the function will return. Has this been decided? -- http://mail.python.org/mailman/listinfo/python-list

Re: print() in Python 3000 return value?

2006-04-02 Thread Martin v. Löwis
James Thiele wrote: > I noticed in PEP 3000 that print will become a function. The PEP > references a thread where Guido explains this decision. The thread does > not specify what the function will return. Has this been decided? My intuition is that it should be a procedure (i.e. returning None).

Sortin Tablelist 4.3

2006-04-02 Thread Arne Meissner
Hello! I am using under Python the tablelist 4.3 from http://www.nemethi.de/. Now I want to do bind the following: When you click on the column header, the selected column should sort. How is the bind method or how can I call the column header in the tablelist? Thany you for your help! Arne

Re: DOM and HTML

2006-04-02 Thread Ant
I've used Beautiful Soup, and it is a very pythonic way of accessing the data in the HTML. It is actually very similar to the way you access the DOM with JS - for example soup.html.body.h1 will give you the first h1 tag. There are also various other ways of searching the HTML in XPathish ways (if

Re: DOM and HTML

2006-04-02 Thread Fredrik Lundh
"Sullivan WxPyQtKinter" wrote: > go ahead to xml.dom.minidom module for help. It has a basic (and great) > implementation for light-weighted DOM implementation. that's a rather unusual way to use words like "great" and "light-weight"... -- http://mail.python.org/mailman/listinfo/python-list

Re: a simple regex question

2006-04-02 Thread Paddy
John Salerno wrote: > But would findall return this match: aMNHiRFLoDLFb ?? > > There are actually two matches there, but they overlap. So how would > your write an RE that catches them both? I remembered the 'non-consuming' match (?+...) and a miniute of experimentation gave the following. >>>

Re: DOM and HTML

2006-04-02 Thread Sullivan WxPyQtKinter
I do not know much about the HTML DOMBut I think if you just mean treating HTML like XML and build it into a DOM tree and (Very important) the HTML file is not a 1 lines or even longer one, then go ahead to xml.dom.minidom module for help. It has a basic (and great) implementation for light

Re: DO NOT USE JAVA BECAUSE IT IS NOT OPEN SOURCE

2006-04-02 Thread Paddy
LoL :-) -- http://mail.python.org/mailman/listinfo/python-list

DOM and HTML

2006-04-02 Thread robert . differentone
Hi All, I am looking for any Python library which can help to get DOM tree from HTML. Is there any way to access HTML DOM, just like accessing it using javascript. Any kind of help is appreciated. Thanks. R -- http://mail.python.org/mailman/listinfo/python-list

Re: why doesn't is work?a script to backup a directory

2006-04-02 Thread Fredrik Lundh
I wrote: > > WindowsError: [Errno 3] : 'O:/eb/mb/S/*.*' > > shutil.rmtree() expects a directory name, not a file pattern. if you leave > out the "*.*" part at the end, it should do what you want. postscript: typically enough, I stumbled upon the same error message myself, a day later. looks lik

Re: Is pwm Python MegaWidgets viable?

2006-04-02 Thread gregarican
Paul Watson wrote: > Does pwm run well on Python 2.4? The last release appears to be in > 2003. The Manning discussion forum is dead. > > Is there a better path to learning and producing tkInter apps? > > > Has there been any discussion of wxPython becoming part of the base > Python distro? A r

Re: RELEASED Python 2.4.3, release candidate 1

2006-04-02 Thread Steve Holden
Paddy wrote: > I just Googled and found the Python-Dev thread 'About "Coverity Study > Ranks LAMP Code Quality" '. I was heartened by the type of issues > raised in the discussion - it leaves me content with whats > 'under-the-hood' in Python. > > You maintainers don't seem to bang your own drum,

Re: Exception handling....dumb question?

2006-04-02 Thread Felipe Almeida Lessa
Em Dom, 2006-04-02 às 15:54 +0300, Flexx escreveu: > Ben Finney writes: > > This allows all other exceptions to propogate back through the call > > stack. > > import sys, logging > try: > foo = 12/0 > except: > e = str(sys.exc_value) > print "You *knew* this was going to happen: '

Re: String pattern matching

2006-04-02 Thread Jim Lewis
Thanks for the interesting and detailed analysis. In my case I don't need all possible answers by rather the first "greedy" match. Seems like there might be some recursive approach. -- http://mail.python.org/mailman/listinfo/python-list

Re: Exception handling....dumb question?

2006-04-02 Thread Flexx
Ben Finney writes: > You should catch *specific* exceptions that you know you can deal with at > that point in the code. > > import logging > try: > foo = 12 / 0 > except ZeroDivisionError, e: > print "You *knew* this was going to happen: '%s'" % e > lo

Re: ipv6 validation

2006-04-02 Thread Christos Georgiou
On 30 Mar 2006 11:40:08 -0800, rumours say that [EMAIL PROTECTED] might have written: >thanks a lot for this solution. >Next thing: how may i find out that that address is multicast one? is >there some easy possibility or i have to use regex now? To quote a Google reply: "IPv6 multicast addresse

Is pwm Python MegaWidgets viable?

2006-04-02 Thread Paul Watson
Does pwm run well on Python 2.4? The last release appears to be in 2003. The Manning discussion forum is dead. Is there a better path to learning and producing tkInter apps? Has there been any discussion of wxPython becoming part of the base Python distro? A requirement here is to not requir

Re: DO NOT USE JAVA BECAUSE IT IS NOT OPEN SOURCE

2006-04-02 Thread Alex Hunsley
[EMAIL PROTECTED] wrote: > Programing Languiges Are Ment to be free. That is why i am starting The > Coo De Tar > thats french for Blow of state No, "Coup d'état" is French. http://en.wikipedia.org/wiki/Coup > it is a flash/java > alternative and if you are going to use a server side languige

Re: Python 2.4.3 Documentation: Bad link

2006-04-02 Thread Tim Parkin
[EMAIL PROTECTED] wrote: > Now, it works well... I really don't know why it before report 404 Not > Found... I was tested it 5x... I'm sorry for unwanted false bug report. Hi Bones, It really was a bug!! I'd seen it reported on the bug tracker and made a quick fix which is why I hadn't closed the