Re: what's this instance?

2008-01-22 Thread Robert Kern
J. Peng wrote: > def safe_float(object): > try: > retval = float(object) > except (ValueError, TypeError), oops: > retval = str(oops) > return retval > > x=safe_float([1,2,3,4]) > print x > > > The code above works well.But what's the instance of "oops"? where is it > coming from?

Re: is it possible to set namespace to an object.

2008-01-22 Thread glomde
On 21 Jan, 22:00, George Sakkis <[EMAIL PROTECTED]> wrote: > On Jan 21, 2:52 pm, glomde <[EMAIL PROTECTED]> wrote: > > > > > On 21 Jan, 20:16, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > On Jan 21, 1:56 pm, glomde <[EMAIL PROTECTED]> wrote: > > > > > On 21 Jan, 18:59, Wildemar Wildenburger > >

Re: what's this instance?

2008-01-22 Thread Marc 'BlackJack' Rintsch
On Tue, 22 Jan 2008 15:36:49 +0800, J. Peng wrote: > def safe_float(object): > try: > retval = float(object) > except (ValueError, TypeError), oops: > retval = str(oops) > return retval > > x=safe_float([1,2,3,4]) > print x > > > The code above works well.But what's the instance o

Re: Calculate net transfer rate without dummy file

2008-01-22 Thread Diez B. Roggisch
whatazor schrieb: > Hi, > how can I calulate transfer rate to a host , without using a file ? > can ping module (written by Jeremy Hylton) be useful ? You can't measure without transmitting data. It's not only the network connection between the two hosts that is important, but also the sending a

Question on sort() key function

2008-01-22 Thread Robert Latest
Hello, I have this class: class File: def __init__(self): self.name = '' self.path = '' self.date = 0 self.mod_date = 0 self.keywords = [] self.url = '' ...and after creating a list of File o

Re: Question on sort() key function

2008-01-22 Thread Paul Rubin
Robert Latest <[EMAIL PROTECTED]> writes: > flist.sort(key=File.mod_date.toordinal) > > However, Python says: > AttributeError: class File has no attribute 'mod_date' The attribute is on instances of File, not on the class itself. See if this works: flist.sort(key=lambda f: f.mod_date.toordi

Re: Just for fun: Countdown numbers game solver

2008-01-22 Thread Terry Jones
Hi Arnaud > I've tried a completely different approach, that I imagine as 'folding'. I > thought it would improve performance over my previous effort but extremely > limited and crude benchmarking seems to indicate disappointingly comparable > performance... I wrote a stack-based version yesterd

Re: what's this instance?

2008-01-22 Thread Bruno Desthuilliers
J. Peng a écrit : > def safe_float(object): > try: > retval = float(object) > except (ValueError, TypeError), oops: > retval = str(oops) > return retval > The code above works well. For which definition of "works well" ? This function is really ill-named - it returns either a float

Re: Question on sort() key function

2008-01-22 Thread Robert Latest
Paul Rubin wrote: > The attribute is on instances of File, not on the class itself. See > if this works: > >flist.sort(key=lambda f: f.mod_date.toordinal) It doesn't throw an error any more, but neither does it sort the list. This, however, works: -- def by_date(f1, f2):

Re: Trouble writing to database: RSS-reader

2008-01-22 Thread Bruno Desthuilliers
MRAB a écrit : > On Jan 21, 9:15 pm, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: >> Arne a écrit : (snip) >>> So, I shouldn't use this techinicke (probably wrong spelled) >> May I suggest "technic" ?-) > > That should be "technique"; just ask a Francophone! :-) My bad :( -- http://mail.py

Re: what's this instance?

2008-01-22 Thread J. Peng
Bruno Desthuilliers 写道: > J. Peng a écrit : >> def safe_float(object): >> try: >> retval = float(object) >> except (ValueError, TypeError), oops: >> retval = str(oops) >> return retval > >> The code above works well. > > For which definition of "works well" ? > I got it from Core

Re: Bug in __init__?

2008-01-22 Thread Bruno Desthuilliers
Bart Ogryczak a écrit : > On 2008-01-18, citizen Zbigniew Braniecki testified: (snip usual default mutable list arg problem) >> class A(): >> >>def add (self, el): >> self.lst.extend(el) >> >>def __init__ (self, val=[]): >> print val >> self.lst = val > > What you want proba

Re: HTML parsing confusion

2008-01-22 Thread John Machin
On Jan 22, 4:31 pm, Alnilam <[EMAIL PROTECTED]> wrote: > Sorry for the noob question, but I've gone through the documentation > on python.org, tried some of the diveintopython and boddie's examples, > and looked through some of the numerous posts in this group on the > subject and I'm still rather

Re: Question on sort() key function

2008-01-22 Thread Peter Otten
Robert Latest wrote: > Paul Rubin wrote: >> The attribute is on instances of File, not on the class itself. See >> if this works: >> >>flist.sort(key=lambda f: f.mod_date.toordinal) > > It doesn't throw an error any more, but neither does it sort the list. This, > however, works: > > -

Re: stdin, stdout, redmon

2008-01-22 Thread Bernard Desnoues
Hello, I checked under linux and it works : text.txt : "first line of the text file second line of the text file" test.py : "import sys a = sys.stdin.readlines() x = ''.join(a) x = x.upper() sys.stdout.write(x)" >cat text.txt | python test.py But I reinstalled Python 2.5 under Windows XP and i

Re: Question on sort() key function

2008-01-22 Thread Robert Latest
Peter Otten wrote: > Robert Latest wrote: > >> Paul Rubin wrote: >>> The attribute is on instances of File, not on the class itself. See >>> if this works: >>> >>>flist.sort(key=lambda f: f.mod_date.toordinal) >> >> It doesn't throw an error any more, but neither does it sort the list. This,

Re: stdin, stdout, redmon

2008-01-22 Thread Tim Golden
Bernard Desnoues wrote: > Hello, > > I checked under linux and it works : > text.txt : > "first line of the text file > second line of the text file" > > test.py : > "import sys > a = sys.stdin.readlines() > x = ''.join(a) > x = x.upper() > sys.stdout.write(x)" > > >cat text.txt | python test.p

Re: stdin, stdout, redmon

2008-01-22 Thread John Machin
On Jan 22, 8:42 pm, Bernard Desnoues <[EMAIL PROTECTED]> wrote: > Hello, > > I checked under linux and it works : > text.txt : > "first line of the text file > second line of the text file" > > test.py : > "import sys > a = sys.stdin.readlines() > x = ''.join(a) > x = x.upper() > sys.stdout.write(x

Re: Question on sort() key function

2008-01-22 Thread Marc 'BlackJack' Rintsch
On Tue, 22 Jan 2008 09:56:55 +, Robert Latest wrote: > Peter Otten wrote: >> Robert Latest wrote: >> >> This should work then: >> >> def date_key(f): >> return f.mod_date.toordinal() >> flist.sort(key=date_key) >> >> This can also be written as >> >> flist.sort(key=lambda f: f.mod_date.too

Re: what's this instance?

2008-01-22 Thread Bruno Desthuilliers
J. Peng a écrit : > Bruno Desthuilliers 写道: >> J. Peng a écrit : >>> def safe_float(object): >>> try: >>> retval = float(object) >>> except (ValueError, TypeError), oops: >>> retval = str(oops) >>> return retval >>> The code above works well. >> For which definition of "works well" ?

possible to overide setattr in local scope?

2008-01-22 Thread glomde
In a class it is poosible to override setattr, so that you can decide how you should handle setting of variables. Is this possible to do outside of an class on module level. mysetattr(obj, var, value): print "Hello" So that test = 5 would print Hello -- http://mail.python.org/mailman/listi

MySQLdb and DictCursor

2008-01-22 Thread Frank Aune
Hi, Im using a MySQLdb connection with a DictCursor, and to me it seems the wrapping to dictionaries only prepend column names when there is an actual conflict in the keywords. I would like the cursor to always prepend table names no matter what. Is this possible? Thanks, -Frank -- http://ma

Re: possible to overide setattr in local scope?

2008-01-22 Thread Diez B. Roggisch
glomde wrote: > In a class it is poosible to override setattr, so that you can decide > how you should > handle setting of variables. > > Is this possible to do outside of an class on module level. > > mysetattr(obj, var, value): > print "Hello" > > So that > > test = 5 > > > would print >

Re: HTML parsing confusion

2008-01-22 Thread Paul Boddie
On 22 Jan, 06:31, Alnilam <[EMAIL PROTECTED]> wrote: > Sorry for the noob question, but I've gone through the documentation > on python.org, tried some of the diveintopython and boddie's examples, > and looked through some of the numerous posts in this group on the > subject and I'm still rather co

Re: assigning values in python and perl

2008-01-22 Thread Antoon Pardon
On 2008-01-17, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Thu, 17 Jan 2008 11:40:59 +0800, J. Peng wrote: > >> May I ask, python's pass-by-reference is passing the object's reference >> to functions, but perl, or C's pass-by-reference is passing the variable >> itself's reference to functions.

Re: ctypes CDLL - which paths are searched?

2008-01-22 Thread Helmut Jarausch
Thomas Heller wrote: > Helmut Jarausch schrieb: >> Hi, >> >> how can I specify the paths to be searched for a dynamic library >> to be loaded by ctypes' CDLL class on a Linux system. >> >> Do I have to set os.environment['LD_LIBRARY_PATH'] ? >> > > ctypes passes the argument given to CDLL(path) st

Re: pairs from a list

2008-01-22 Thread Alan Isaac
I suppose my question should have been, is there an obviously faster way? Anyway, of the four ways below, the first is substantially fastest. Is there an obvious reason why? Thanks, Alan Isaac PS My understanding is that the behavior of the last is implementation dependent and not guaranteed. d

Re: Question on sort() key function

2008-01-22 Thread Paul Rubin
Robert Latest <[EMAIL PROTECTED]> writes: > >flist.sort(key=lambda f: f.mod_date.toordinal) > > It doesn't throw an error any more, but neither does it sort the list. This, > however, works: Oh, I didn't realize that toordinal was a callable, given your earlier sample. You want: flist.s

Re: stdin, stdout, redmon

2008-01-22 Thread Rolf van de Krol
Well, that's at least weird. I did test my code with Python 2.5 on Win XP, using the command prompt. But testing it with IDLE gives exactly the same error Bernard has. So apparently STDIN can't be accessed with IDLE. Rolf John Machin wrote: > > Excuse me, gentlemen, may I be your referee *befor

isgenerator(...) - anywhere to be found?

2008-01-22 Thread Diez B. Roggisch
For a simple greenlet/tasklet/microthreading experiment I found myself in the need to ask the question isgenerator(v) but didn't find any implementation in the usual suspects - builtins or inspect. I was able to help myself out with a simple (out of my head, hope its def isgenerator(v): def

Re: ctypes CDLL - which paths are searched?

2008-01-22 Thread Thomas Heller
Helmut Jarausch schrieb: > Thomas Heller wrote: >> Helmut Jarausch schrieb: >>> Hi, >>> >>> how can I specify the paths to be searched for a dynamic library >>> to be loaded by ctypes' CDLL class on a Linux system. >>> >>> Do I have to set os.environment['LD_LIBRARY_PATH'] ? >>> >> >> ctypes passe

Re: HTML parsing confusion

2008-01-22 Thread Alnilam
> Pardon me, but the standard issue Python 2.n (for n in range(5, 2, > -1)) doesn't have an xml.dom.ext ... you must have the mega-monstrous > 200-modules PyXML package installed. And you don't want the 75Kb > BeautifulSoup? I wasn't aware that I had PyXML installed, and can't find a reference to

Re: isgenerator(...) - anywhere to be found?

2008-01-22 Thread Stefan Rank
on 22.01.2008 14:20 Diez B. Roggisch said the following: > > def isgenerator(v): > def _g(): yield > return type(v) == type(_g()) > > But I wonder why there is no such method already available? This tests for generator objects, and you could also use:: return type(v) is types.Genera

Re: isgenerator(...) - anywhere to be found?

2008-01-22 Thread Jean-Paul Calderone
On Tue, 22 Jan 2008 14:20:35 +0100, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >For a simple greenlet/tasklet/microthreading experiment I found myself in >the need to ask the question > >isgenerator(v) > >but didn't find any implementation in the usual suspects - builtins or >inspect. > >I was

Re: stdin, stdout, redmon

2008-01-22 Thread Konstantin Shaposhnikov
Hi, This is Windows bug that is described here: http://support.microsoft.com/default.aspx?kbid=321788 This article also contains solution: you need to add registry value: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies \Explorer InheritConsoleHandles = 1 (REG_DWORD type)

Problem with processing XML

2008-01-22 Thread John Carlyle-Clarke
Hi. I'm new to Python and trying to use it to solve a specific problem. I have an XML file in which I need to locate a specific text node and replace the contents with some other text. The text in question is actually about 70k of base64 encoded data. I wrote some code that works on my Linux

Re: building psycopg2 on windows using mingw, "cannot find -lpq"

2008-01-22 Thread GHUM
> > The compile works, BUT linking fails: > > > 2.5\Release\psycopg\_psycopg.def -Lc:\python25\libs -Lc: > > \python25\PCBuild -Lc:/p > > ostgres/83RC2/lib -lpython25 -lpq -lws2_32 -ladvapi32 -o build > > >  -Lc:/postgres/83RC2/lib > > Are you sure using forward slashes in the path works here? Not

Re: building psycopg2 on windows using mingw, "cannot find -lpq"

2008-01-22 Thread GHUM
> I use psycopg2 all the time on windows. I use the binary installer > instead of source. Works great for me. > > -Tom Me2. Just in 7 out of 200 it does not work with the currently available binary installer, on some startups, so I decided to follow a recommendation out of the psycopg2 list to comp

Re: isgenerator(...) - anywhere to be found?

2008-01-22 Thread Diez B. Roggisch
Jean-Paul Calderone wrote: > On Tue, 22 Jan 2008 14:20:35 +0100, "Diez B. Roggisch" > <[EMAIL PROTECTED]> wrote: >>For a simple greenlet/tasklet/microthreading experiment I found myself in >>the need to ask the question >> >>isgenerator(v) >> >>but didn't find any implementation in the usual suspe

Re: isgenerator(...) - anywhere to be found?

2008-01-22 Thread Diez B. Roggisch
Stefan Rank wrote: > on 22.01.2008 14:20 Diez B. Roggisch said the following: >> >> def isgenerator(v): >> def _g(): yield >> return type(v) == type(_g()) >> >> But I wonder why there is no such method already available? > > > This tests for generator objects, and you could also use::

Re: pairs from a list

2008-01-22 Thread Arnaud Delobelle
On Jan 22, 1:19 pm, Alan Isaac <[EMAIL PROTECTED]> wrote: [...] > PS My understanding is that the behavior > of the last is implementation dependent > and not guaranteed. [...] > def pairs4(x): >     xiter = iter(x) >     for x12 in izip(xiter,xiter): >         yield x12 According to the docs [1],

make exe from application with py2exe

2008-01-22 Thread vedrandekovic
Hello, Is there any idea how can i create (.exe) from application (.exe ) with py2exe? Regards, Vedran -- http://mail.python.org/mailman/listinfo/python-list

Re: stdin, stdout, redmon

2008-01-22 Thread Konstantin Shaposhnikov
Sorry, I meant: Alternatively you can use following command cat file | python script.py instead of cat file | script.py On Jan 22, 1:54 pm, Konstantin Shaposhnikov <[EMAIL PROTECTED]> wrote: > Hi, > > This is Windows bug that is described > here:http://support.microsoft.com/default.asp

Re: Max Long

2008-01-22 Thread [EMAIL PROTECTED]
On Jan 21, 7:42 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Mon, 21 Jan 2008 22:02:34 -0200, [EMAIL PROTECTED]   > <[EMAIL PROTECTED]> escribió: > > > > > > > On Jan 21, 5:36 pm, Gary Herron <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] wrote: > >> > How can I figure out the largest

Re: make exe from application with py2exe

2008-01-22 Thread propanbutan
[EMAIL PROTECTED] wrote: > Is there any idea how can i create (.exe) from application (.exe ) > with py2exe? yes. here [1], here [2] and maybe here [3]. bye. http://catb.org/~esr/faqs/smart-questions.html [1] http://www.google.com [2] http://www.py2exe.org [3] -- http://mail.python.org/mailman/li

Re: isgenerator(...) - anywhere to be found?

2008-01-22 Thread Diez B. Roggisch
Jean-Paul Calderone wrote: > On Tue, 22 Jan 2008 15:15:43 +0100, "Diez B. Roggisch" > <[EMAIL PROTECTED]> wrote: >>Jean-Paul Calderone wrote: >> >>> On Tue, 22 Jan 2008 14:20:35 +0100, "Diez B. Roggisch" >>> <[EMAIL PROTECTED]> wrote: For a simple greenlet/tasklet/microthreading experiment I f

ANN: pyglet 1.0

2008-01-22 Thread Alex Holkner
The first stable/production version of pyglet has been released. http://www.pyglet.org --- pyglet provides an object-oriented programming interface for developing games and other visually-rich applications for Windows, Mac OS X and Linux. Some of the features of pyglet are: * No external de

Re: isgenerator(...) - anywhere to be found?

2008-01-22 Thread Jean-Paul Calderone
On Tue, 22 Jan 2008 15:15:43 +0100, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >Jean-Paul Calderone wrote: > >> On Tue, 22 Jan 2008 14:20:35 +0100, "Diez B. Roggisch" >> <[EMAIL PROTECTED]> wrote: >>>For a simple greenlet/tasklet/microthreading experiment I found myself in >>>the need to ask th

Re: HTML parsing confusion

2008-01-22 Thread Paul McGuire
On Jan 22, 7:44 am, Alnilam <[EMAIL PROTECTED]> wrote: > ...I move from computer to > computer regularly, and while all have a recent copy of Python, each > has different (or no) extra modules, and I don't always have the > luxury of downloading extras. That being said, if there's a simple way > of

Re: isgenerator(...) - anywhere to be found?

2008-01-22 Thread Paul McGuire
On Jan 22, 7:46 am, Stefan Rank <[EMAIL PROTECTED]> wrote: > I also need to test for generator functions from time to time for which > I use:: > >    def _isaGeneratorFunction(func): >        '''Check the bitmask of `func` for the magic generator flag.''' >        return bool(func.func_code.co_flag

Don't want child process inheriting open sockets

2008-01-22 Thread Steven Watanabe
I'm using subprocess.Popen() to create a child process. The child process is inheriting the parent process' open sockets, but I don't want that. I believe that on Unix systems I could use the FD_CLOEXEC flag, but I'm running Windows. Any suggestions? -- http://mail.python.org/mailman/listinfo/p

Re: Problem with processing XML

2008-01-22 Thread Paul McGuire
On Jan 22, 8:11 am, John Carlyle-Clarke <[EMAIL PROTECTED]> wrote: > Hi. > > I'm new to Python and trying to use it to solve a specific problem.  I > have an XML file in which I need to locate a specific text node and > replace the contents with some other text.  The text in question is > actually

Re: isgenerator(...) - anywhere to be found?

2008-01-22 Thread Christian Heimes
Stefan Rank wrote: > on 22.01.2008 14:20 Diez B. Roggisch said the following: >> def isgenerator(v): >> def _g(): yield >> return type(v) == type(_g()) >> >> But I wonder why there is no such method already available? > > > This tests for generator objects, and you could also use:: > >

Re: isgenerator(...) - anywhere to be found?

2008-01-22 Thread Jean-Paul Calderone
On Tue, 22 Jan 2008 15:52:02 +0100, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >Jean-Paul Calderone wrote: > > [snip] >> >> Sorry, I still don't understand. Why is a generator different from any >> other iterator? > >Because you can use send(value) on it for example. Which you can't with >ever

Re: pairs from a list

2008-01-22 Thread bearophileHUGS
Alan Isaac>What is the fastest way? (Ignore the import time.)< Maybe someday someone will realize such stuff belongs to the python STD lib... If you need a lazy generator without padding, that splits starting from the start, then this is the faster to me if n is close to 2: def xpartition(seq, n

Re: isgenerator(...) - anywhere to be found?

2008-01-22 Thread Stefan Rank
on 22.01.2008 16:09 Paul McGuire said the following: > On Jan 22, 7:46 am, Stefan Rank <[EMAIL PROTECTED]> wrote: >> I also need to test for generator functions from time to time for which >> I use:: >> >>def _isaGeneratorFunction(func): >>'''Check the bitmask of `func` for the magic ge

Re: Curses and Threading

2008-01-22 Thread Brett . Friermood
> In fact you have *two* threads: the main thread, and the one you create > explicitly. > After you start the clock thread, the main thread continues executing, > immediately entering the finally clause. > If you want to wait for the other thread to finish, use the join() method. > But I'm unsure

Re: pairs from a list

2008-01-22 Thread Alan Isaac
Arnaud Delobelle wrote: > According to the docs [1], izip is defined to be equivalent to: > > def izip(*iterables): > iterables = map(iter, iterables) > while iterables: > result = [it.next() for it in iterables] > yield tuple(result) > > This guar

Re: pairs from a list

2008-01-22 Thread Arnaud Delobelle
On Jan 22, 1:19 pm, Alan Isaac <[EMAIL PROTECTED]> wrote: > I suppose my question should have been, > is there an obviously faster way? > Anyway, of the four ways below, the > first is substantially fastest.  Is > there an obvious reason why? Can you post your results? I get different ones (pairs

Re: Problem with processing XML

2008-01-22 Thread Alnilam
On Jan 22, 9:11 am, John Carlyle-Clarke <[EMAIL PROTECTED]> wrote: > By the way, is pyxml a live project or not?  Should it still be used? > It's odd that if you go tohttp://www.python.org/and click the link > "Using python for..." XML, it leads you tohttp://pyxml.sourceforge.net/topics/ > > If yo

Re: HTML parsing confusion

2008-01-22 Thread Alnilam
On Jan 22, 8:44 am, Alnilam <[EMAIL PROTECTED]> wrote: > > Pardon me, but the standard issue Python 2.n (for n in range(5, 2, > > -1)) doesn't have an xml.dom.ext ... you must have the mega-monstrous > > 200-modules PyXML package installed. And you don't want the 75Kb > > BeautifulSoup? > > I wasn'

Re: isgenerator(...) - anywhere to be found?

2008-01-22 Thread james . pye
On Jan 22, 6:20 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > For a simple greenlet/tasklet/microthreading experiment I found myself in > the need to ask the question > > isgenerator(v) > > but didn't find any implementation in the usual suspects - builtins or > inspect. types.GeneratorType

Re: pairs from a list

2008-01-22 Thread Arnaud Delobelle
On Jan 22, 4:10 pm, Alan Isaac <[EMAIL PROTECTED]> wrote: > http://bugs.python.org/issue1121416> > > fwiw, > Alan Isaac Thanks. So I guess I shouldn't take the code snippet I quoted as a specification of izip but rather as an illustration. -- Arnaud -- http://mail.python.org/mailman/listinfo/

Re: stdin, stdout, redmon

2008-01-22 Thread Thynnus
On 1/21/2008 9:02 AM, Bernard Desnoues wrote: > Hi, > > I've got a problem with the use of Redmon (redirection port monitor). I > intend to develop a virtual printer so that I can modify data sent to > the printer. FWIW: there is a nice update the RedMon (v1.7) called RedMon EE (v1.81) availab

Re: Problem with processing XML

2008-01-22 Thread Paul Boddie
On 22 Jan, 15:11, John Carlyle-Clarke <[EMAIL PROTECTED]> wrote: > > I wrote some code that works on my Linux box using xml.dom.minidom, but > it will not run on the windows box that I really need it on. Python > 2.5.1 on both. > > On the windows machine, it's a clean install of the Python .msi fr

Re: HTML parsing confusion

2008-01-22 Thread Diez B. Roggisch
Alnilam wrote: > On Jan 22, 8:44 am, Alnilam <[EMAIL PROTECTED]> wrote: >> > Pardon me, but the standard issue Python 2.n (for n in range(5, 2, >> > -1)) doesn't have an xml.dom.ext ... you must have the mega-monstrous >> > 200-modules PyXML package installed. And you don't want the 75Kb >> > Beau

Re: stdin, stdout, redmon

2008-01-22 Thread Thynnus
On 1/22/2008 8:54 AM, Konstantin Shaposhnikov wrote: > Hi, > > This is Windows bug that is described here: > http://support.microsoft.com/default.aspx?kbid=321788 > > This article also contains solution: you need to add registry value: > > HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVe

Processing XML that's embedded in HTML

2008-01-22 Thread Mike Driscoll
Hi, I need to parse a fairly complex HTML page that has XML embedded in it. I've done parsing before with the xml.dom.minidom module on just plain XML, but I cannot get it to work with this HTML page. The XML looks like this: Owner 1 07/16/2007 No Doe, John 1905 S

Re: Boa constructor debugging - exec some code at breakpoint?

2008-01-22 Thread Mike Driscoll
On Jan 22, 1:23 am, Joel <[EMAIL PROTECTED]> wrote: > Can you please tell me how this can be done.. > are there any other IDEs for the same purpose if Boa can't do it? > > Joel > > On Jan 6, 11:01 am, Joel <[EMAIL PROTECTED]> wrote: > > > Hey there.. > > I'm using boa constructor to debug a python

Re: Curses and Threading

2008-01-22 Thread Ian Clark
On 2008-01-22, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> In fact you have *two* threads: the main thread, and the one you create >> explicitly. > >> After you start the clock thread, the main thread continues executing, >> immediately entering the finally clause. >> If you want to wait for th

Submitting with PAMIE

2008-01-22 Thread romo20350
Hi I really need help. I've been looking around for an answer forever. I need to submit a form with no name and also the submit button has no name or value. How might I go about doing either of these. Thanks -- http://mail.python.org/mailman/listinfo/python-list

Using utidylib, empty string returned in some cases

2008-01-22 Thread Boris
Hello I'm using debian linux, Python 2.4.4, and utidylib (http:// utidylib.berlios.de/). I wrote simple functions to get a web page, convert it from windows-1251 to utf8 and then I'd like to clean html with it. Here is two pages I use to check my program: http://www.ya.ru/ (in this case everythin

Re: Processing XML that's embedded in HTML

2008-01-22 Thread Paul Boddie
On 22 Jan, 17:57, Mike Driscoll <[EMAIL PROTECTED]> wrote: > > I need to parse a fairly complex HTML page that has XML embedded in > it. I've done parsing before with the xml.dom.minidom module on just > plain XML, but I cannot get it to work with this HTML page. It's HTML day on comp.lang.python

Re: isgenerator(...) - anywhere to be found?

2008-01-22 Thread Steven Bethard
Diez B. Roggisch wrote: > Jean-Paul Calderone wrote: > >> On Tue, 22 Jan 2008 15:15:43 +0100, "Diez B. Roggisch" >> <[EMAIL PROTECTED]> wrote: >>> Jean-Paul Calderone wrote: >>> On Tue, 22 Jan 2008 14:20:35 +0100, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > For a simple greenlet/

Beginners question about debugging (import)

2008-01-22 Thread Albert van der Horst
I'm starting with Python. First with some interactive things, working through the tutorial, then with definitions in a file called sudoku.py. Of course I make lots of mistakes, so I have to include that file time and again. I discovered (the hard way) that the second time you invoke from sudok

Re: pairs from a list

2008-01-22 Thread Alan Isaac
Arnaud Delobelle wrote: > pairs4 wins. Oops. I see a smaller difference, but yes, pairs4 wins. Alan Isaac import time from itertools import islice, izip x = range(51) def pairs1(x): return izip(islice(x,0,None,2),islice(x,1,None,2)) def pairs2(x): xiter = iter(x) while True:

Re: Beginners question about debugging (import)

2008-01-22 Thread Diez B. Roggisch
Albert van der Horst schrieb: > I'm starting with Python. First with some interactive things, > working through the tutorial, > then with definitions in a file called sudoku.py. > Of course I make lots of mistakes, so I have to include that file > time and again. > > I discovered (the hard way) th

rpy registry

2008-01-22 Thread [EMAIL PROTECTED]
Howdy, I've been using rpy (1.0.1) and python (2.5.1) on my office computer with great success. When I went to put rpy on my laptop, however, I get an error trying to load rpy. "Unable to determine R version from the registry. Trying another method." followed by a few lines of the usual error me

difflib confusion

2008-01-22 Thread krishnakant Mane
hello all, I have a bit of a confusing question. firstly I wanted a library which can do an svn like diff with two files. let's say I have file1 and file2 where file2 contains some thing which file1 does not have. now if I do readlines() on both the files, I have a list of all the lines. I now wan

Re: printing escape character

2008-01-22 Thread Jerry Hill
On Jan 22, 2008 1:38 PM, hrochonwo <[EMAIL PROTECTED]> wrote: > Hi, > > I want to print string without "decoding" escaped characters to > newline etc. > like print "a\nb" -> a\nb > is there a simple way to do it in python or should i somehow use > string.replace(..) function ? >>> print 'a\nb'.enc

Re: pairs from a list

2008-01-22 Thread Arnaud Delobelle
On Jan 22, 6:34 pm, Paddy <[EMAIL PROTECTED]> wrote: [...] > Hi George, > You need to 'get it right' first. Micro optimizations for speed > without thought of the wider context is a bad habit to form and a time > waster. > If the routine is all that needs to be delivered and it does not > perform a

Re: printing escape character

2008-01-22 Thread hrochonwo
On Jan 22, 7:58 pm, "Jerry Hill" <[EMAIL PROTECTED]> wrote: > On Jan 22, 2008 1:38 PM, hrochonwo <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I want to print string without "decoding" escaped characters to > > newline etc. > > like print "a\nb" -> a\nb > > is there a simple way to do it in python or

Re: pairs from a list

2008-01-22 Thread Paddy
On Jan 22, 5:34 am, George Sakkis <[EMAIL PROTECTED]> wrote: > On Jan 22, 12:15 am, Paddy <[EMAIL PROTECTED]> wrote: > > > On Jan 22, 3:20 am, Alan Isaac <[EMAIL PROTECTED]> wrote:> I want to > > generate sequential pairs from a list. > > <> > > > What is the fastest way? (Ignore the import time.)

printing escape character

2008-01-22 Thread hrochonwo
Hi, I want to print string without "decoding" escaped characters to newline etc. like print "a\nb" -> a\nb is there a simple way to do it in python or should i somehow use string.replace(..) function ? thanks for any reply hrocho -- http://mail.python.org/mailman/listinfo/python-list

A global or module-level variable?

2008-01-22 Thread Bret
This has to be easier than I'm making it I've got a module, remote.py, which contains a number of classes, all of whom open a port for communication. I'd like to have a way to coordinate these port numbers akin to this: So I have this in the __init__.py file for a package called cstore: nex

question

2008-01-22 Thread jyoung79
I'm still learning Python and was wanting to get some thoughts on this. I apologize if this sounds ridiculous... I'm mainly asking it to gain some knowledge of what works better. The main question I have is if I had a lot of lists to choose from, what's the best way to write the code so I'm n

Re: A global or module-level variable?

2008-01-22 Thread Paul Rubin
Bret <[EMAIL PROTECTED]> writes: > nextport=42000 > > def getNextPort(): > nextport += 1 > return nextport If you have to do it that way, use: def getNextPort(): global nextport nextport += 1 return nextport the global declaration stops the compiler from trea

Re: pairs from a list

2008-01-22 Thread Peter Otten
Arnaud Delobelle wrote: > On Jan 22, 4:10 pm, Alan Isaac <[EMAIL PROTECTED]> wrote: > >> http://bugs.python.org/issue1121416> >> >> fwiw, >> Alan Isaac > > Thanks. So I guess I shouldn't take the code snippet I quoted as a > specification of izip but rather as an illustration. You can be bolde

Re: Problem with processing XML

2008-01-22 Thread John Carlyle-Clarke
Paul McGuire wrote: > > Here is a pyparsing hack for your problem. Thanks Paul! This looks like an interesting approach, and once I get my head around the syntax, I'll give it a proper whirl. -- http://mail.python.org/mailman/listinfo/python-list

Re: question

2008-01-22 Thread James Matthews
Since you aren't familyer with classes i will keep this within the scope of functions... If you have code like this def a(): def b(): a+=1 Then you can only call function b when you are within function a James On Jan 22, 2008 8:58 PM, <[EMAIL PROTECTED]> wrote: > I'm still learning Pyt

Re: PyGTK, Glade, and ComboBoxEntry.append_text()

2008-01-22 Thread Yann Leboulanger
Greg Johnston wrote: > Hey all, > > I'm a relative newbie to Python (switched over from Scheme fairly > recently) but I've been using PyGTK and Glade to create an interface, > which is a combo I'm very impressed with. > > There is, however, one thing I've been wondering about. It doesn't > seem p

Re: question

2008-01-22 Thread Arnaud Delobelle
On Jan 22, 7:58 pm, <[EMAIL PROTECTED]> wrote: > I'm still learning Python and was wanting to get some thoughts on this.  I > apologize if this sounds ridiculous...  I'm mainly asking it to gain some > knowledge of what works better.  The main question I have is if I had a lot > of lists to choo

Re: pairs from a list

2008-01-22 Thread Raymond Hettinger
[Peter Otten] > You can be bolder here as the izip() docs explicitly state > > """ > Note, the left-to-right evaluation order of the iterables is > guaranteed. This makes possible an idiom for clustering a data series into > n-length groups using "izip(*[iter(s)]*n)". > """ . . . > is about zip(),

Re: question

2008-01-22 Thread Tim Chase
> def albumInfo(theBand): > def Rush(): > return ['Rush', 'Fly By Night', 'Caress of Steel', '2112', 'A Farewell to Kings', 'Hemispheres'] > > def Enchant(): > return ['A Blueprint of the World', 'Wounded', 'Time Lost'] > > The only problem with the code above though is that

Re: bags? 2.5.x?

2008-01-22 Thread MRAB
On Jan 21, 11:13 pm, Dan Stromberg <[EMAIL PROTECTED]> wrote: > On Thu, 17 Jan 2008 18:18:53 -0800, Raymond Hettinger wrote: > >> >> I keep wanting something like them - especially bags with something > >> >> akin to set union, intersection and difference. > > >> > How about this recepie > >> > htt

Re: Processing XML that's embedded in HTML

2008-01-22 Thread Mike Driscoll
On Jan 22, 11:32 am, Paul Boddie <[EMAIL PROTECTED]> wrote: > > The rest of the document is html, javascript div tags, etc. I need the > > information only from the row where the Relationship tag = Owner and > > the Priority tag = 1. The rest I can ignore. When I tried parsing it > > with minidom,

Re: question

2008-01-22 Thread Wildemar Wildenburger
Hi there :) A little tip upfront: In the future you might want to come up with a more descriptive subject line. This will help readers decide early if they can possibly help or not. [EMAIL PROTECTED] wrote: > def albumInfo(theBand): > def Rush(): > return ['Rush', 'Fly By Night', 'C

Re: Bug in __init__?

2008-01-22 Thread Bart Ogryczak
On 2008-01-22, citizen Bruno Desthuilliers testified: >> from copy import copy >> ### see also deepcopy >> self.lst = copy(val) > > What makes you think the OP wants a copy ? I´m guessing he doesn´t want to mutate original list, while

Re: HTML parsing confusion

2008-01-22 Thread Alnilam
On Jan 22, 11:39 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Alnilam wrote: > > On Jan 22, 8:44 am, Alnilam <[EMAIL PROTECTED]> wrote: > >> > Pardon me, but the standard issue Python 2.n (for n in range(5, 2, > >> > -1)) doesn't have an xml.dom.ext ... you must have the mega-monstrous > >>

Re: get the size of a dynamically changing file fast ?

2008-01-22 Thread Stef Mientki
Mike Driscoll wrote: > On Jan 17, 3:56 pm, Stef Mientki <[EMAIL PROTECTED]> wrote: > >> hello, >> >> I've a program (not written in Python) that generates a few thousands >> bytes per second, >> these files are dumped in 2 buffers (files), at in interval time of 50 msec, >> the files can be read

  1   2   >