Re: XML-RPC "filter"

2008-09-12 Thread luigi . paioro
On 11 Set, 18:45, Richard Levasseur <[EMAIL PROTECTED]> wrote: > Because he wants to insert parameters at the very start, he can > probably get away with modifying the xml directly.  Just find the > position of the (i think thats the tag) and insert the xml > you need after it.  Its pretty dirty,

Re: PLEASE HELP ME WITH THIS ASSIGNMENT...PLEASE....

2008-09-12 Thread Almar Klein
> > I find it impossible to take anyone asking others to do their school > work for them seriously no matter how or what they are willing to pay. > Exactly, and writing the subject of the post in all capitals doesn't help either... Almar -- http://mail.python.org/mailman/listinfo/python-list

Re: handling uncaught exceptions with pdb?

2008-09-12 Thread R. Bernstein
Paul Rubin writes: > I think I've asked about this before, but is there a way to set up > Python to handle uncaught exceptions with pdb? I know about setting > sys.except_hook to something that calls pdb, but this is normally done > at the outer level of a program, and

Re: Better error message on recursive import

2008-09-12 Thread Thomas Guettler
Hi, Can you give an example of such a recursive import you want the special exception be raised? ===> cat one.py from two import testtwo def testone(): print "one" ===> cat two.py import one def testtwo(): print "two" ===> python one.py Traceback (most recent call last): File "one.

Re: rss feed generation

2008-09-12 Thread Tim Golden
Walter Cruz wrote: On Tue, Sep 9, 2008 at 9:35 PM, alex23 <[EMAIL PROTECTED]> wrote: On Sep 10, 7:30 am, "Blake Garner" <[EMAIL PROTECTED]> wrote: I'm looking for suggestions on how to approach generating rss feed .xml files using python. What modules to people recommend I start with? I just

Re: handling uncaught exceptions with pdb?

2008-09-12 Thread Diez B. Roggisch
R. Bernstein schrieb: Paul Rubin writes: I think I've asked about this before, but is there a way to set up Python to handle uncaught exceptions with pdb? I know about setting sys.except_hook to something that calls pdb, but this is normally done at the outer level o

Re: rss feed generation

2008-09-12 Thread Tim Golden
Tim Golden wrote: Walter Cruz wrote: On Tue, Sep 9, 2008 at 9:35 PM, alex23 <[EMAIL PROTECTED]> wrote: On Sep 10, 7:30 am, "Blake Garner" <[EMAIL PROTECTED]> wrote: I'm looking for suggestions on how to approach generating rss feed .xml files using python. What modules to people recommend I st

Re: handling uncaught exceptions with pdb?

2008-09-12 Thread Thomas Heller
Paul Rubin schrieb: > I think I've asked about this before, but is there a way to set up > Python to handle uncaught exceptions with pdb? I know about setting > sys.except_hook to something that calls pdb, but this is normally done > at the outer level of a program, and by the time that hook gets

Python on Windows XP 64-bit: python not found in registry

2008-09-12 Thread Berco Beute
After first trying to install the beta of Python 2.6 on my Windows XP 64-bit machine I finally succeeded installing 2.5.2. But I still have a some problem: Installing iPython, PIL, easy_install etc fails saying that python.exe cannot be found (although I can start the python interpeter just fine).

Re: dynamic allocation file buffer

2008-09-12 Thread Paul Boddie
On 12 Sep, 08:30, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > > Which is why I previously said that XML was not well suited for random > access. Maybe not. A consideration of other storage formats such as HDF5 might be appropriate: http://hdf.ncsa.uiuc.edu/HDF5/whatishdf5.html There are, of cou

Re: Accessing __slots__ from C

2008-09-12 Thread Hrvoje Niksic
Chris <[EMAIL PROTECTED]> writes: >> PyObject_GetAttrString is convenient, but it creates a Python string >> only so it can intern it (and in most cases throw away the freshly >> created version). For maximum efficiency, pre-create the string >> object using PyString_InternFromString, and use tha

Re: Good programming style

2008-09-12 Thread Bruno Desthuilliers
Astley Le Jasper a écrit : I'm still learning python and would like to know what's a good way of organizing code. I am writing some scripts to scrape a number of different website that hold similar information and then collating it all together. Obviously each site needs to be handled differentl

Re: PLEASE HELP ME WITH THIS ASSIGNMENT...PLEASE....

2008-09-12 Thread Bruno Desthuilliers
Daniel Fetchinson a écrit : Thanking you, Ms. Vaidehi Pawar How much do you pay? How much do you ask for cheers Ms. Vaidehi I was just kidding. But if you seriously need people to do this kind of job it's better to post the amount you are willing to pay otherwise nobody will take it

Re: Better error message on recursive import

2008-09-12 Thread Wojtek Walczak
On Thu, 11 Sep 2008 12:43:34 +0200, Thomas Guettler wrote: Hello, > why does Python only raise ImportError if it fails caused by a recursive > import? > > I know what's wrong. But I guess many beginner don't know what's wrong. I don't think that you're right here. I can't remember any beginner

Re: Good programming style

2008-09-12 Thread Astley Le Jasper
On 12 Sep, 12:44, Bruno Desthuilliers wrote: > Astley Le Jasper a écrit : > > > I'm still learning python and would like to know what's a good way of > > organizing code. > > > I am writing some scripts to scrape a number of different website that > > hold similar information and then collating it

Re: handling uncaught exceptions with pdb?

2008-09-12 Thread R. Bernstein
"Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > R. Bernstein schrieb: >> Paul Rubin writes: >> >>> I think I've asked about this before, but is there a way to set up >>> Python to handle uncaught exceptions with pdb? I know about setting >>> sys.except_hook to somethin

Re: dict slice in python (translating perl to python}

2008-09-12 Thread Hendrik van Rooyen
MRAB wrote: >On Sep 11, 6:11 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: >[snip] >> (the next step towards true Pythonicness would be to store your data in 8<--- >> >Surely the word is "Pythonicity"? :-) When faced with the choice between "Pythonicness" and "Pythonicity", I

Re: Better error message on recursive import

2008-09-12 Thread Marc 'BlackJack' Rintsch
On Fri, 12 Sep 2008 09:47:42 +0200, Thomas Guettler wrote: >> Can you give an example of such a recursive import you want the special >> exception be raised? > > ===> cat one.py > from two import testtwo > def testone(): > print "one" > > ===> cat two.py > import one > def testtwo(): >

Re: handling uncaught exceptions with pdb?

2008-09-12 Thread Simon Brunning
2008/9/10 Paul Rubin <"http://phr.cx"@nospam.invalid>: > I think I've asked about this before, but is there a way to set up > Python to handle uncaught exceptions with pdb? http://code.activestate.com/recipes/65287/ -- Cheers, Simon B. [EMAIL PROTECTED] http://www.brunningonline.net/simon/blog/

Matching horizontal white space

2008-09-12 Thread Magnus . Moraberg
multipleSpaces = re.compile(u'\\h+') importantTextString = '\n \n \n \t\t ' importantTextString = multipleSpaces.sub("M", importantTextString) I would have expected consecutive spaces and tabs to be replaced by M but nothing is being replaced. If I try the following, then I'm left only with M,

testing if another instance of a script is already running

2008-09-12 Thread Strato
Hi folks, I want to write some kind of test to check at startup if another instance of my script is already running. I don't want to handle writing of a PID file because it is too Unix/Linux specific way to do this, and I need to keep the code to be cross-platform. I think the better way t

Re: lacking follow-through

2008-09-12 Thread Steve Holden
castironpi wrote: > On Sep 7, 5:03 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >> On Mon, 08 Sep 2008 07:34:55 +1000, James Mills wrote: >>> This is the strangest post I've seen >>> since I've joined this list (only >>> recently). What the ? >> Yeah, castironpi sometimes doesn't make mu

Re: Accessing __slots__ from C

2008-09-12 Thread Chris
Carl Banks gmail.com> writes: ... > You can determine the offset the of the slot in the object structure > by > querying the member descriptor of the type object. That sounds like just the kind of thing we were looking for - thanks! > descr = GetAttrString(cls,"varname"); > offset = descr->d_mem

Re: Gateway to python-list is generating bounce messages.

2008-09-12 Thread Steven D'Aprano
On Thu, 11 Sep 2008 17:27:33 +0200, Sjoerd Mullender wrote: > When mail messages bounce, the MTA (Message Transfer Agent--the program > that handles mail) *should* send the bounce message to whatever is in > the Sender header, and only if that header does not exist, should it use > the From header

Re: testing if another instance of a script is already running

2008-09-12 Thread Tim Golden
Strato wrote: Hi folks, I want to write some kind of test to check at startup if another instance of my script is already running. I don't want to handle writing of a PID file because it is too Unix/Linux specific way to do this, and I need to keep the code to be cross-platform. I think t

Re: String to hexadecimal conversion

2008-09-12 Thread Steve Holden
Praveena P wrote: > Hi folks, > > I am new to Python... so am not too sure about how the type conversion > works. > > I have to read a file that contains hexadecimal data and use the data > further to do some arithmetic calculations. > A sample of the input is : 20E032F840

Re: lacking follow-through

2008-09-12 Thread Steve Holden
castironpi wrote: [...] > For example, I sometimes hear people talk about salary as though it > were social approval, and vice versa. Even though the analogy doesn't > hold in every case generally, it is still a good way to express > yourself in many contexts, and especially when the more precise

Re: testing if another instance of a script is already running

2008-09-12 Thread Tim Golden
Tim Golden wrote: Strato wrote: Hi folks, I want to write some kind of test to check at startup if another instance of my script is already running. I don't want to handle writing of a PID file because it is too Unix/Linux specific way to do this, and I need to keep the code to be cross-pl

Re: Please help me finding a way to implement os.path.issubpath(a, b)

2008-09-12 Thread Giampaolo Rodola'
On Sep 11, 8:04 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > On Sep 11, 5:40 pm, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > I'm trying to implement a function which returns whether a path is a > > subpath of another one (e.g. /a/b/c is a subpath of /a/b). > > I wrote this

Re: dynamic allocation file buffer

2008-09-12 Thread Aaron "Castironpi" Brady
On Sep 12, 4:34 am, Paul Boddie <[EMAIL PROTECTED]> wrote: > On 12 Sep, 08:30, Steven D'Aprano > > <[EMAIL PROTECTED]> wrote: > > > Which is why I previously said that XML was not well suited for random > > access. > > Maybe not. No, it's not. Element trees are, which if I just would have said or

Injecting new names into the above frame

2008-09-12 Thread Peter Waller
Dear Pythoners, I know this will probably be perceived as 'evil voodoo', and fair enough: it probably is. I guess it is unpythonic. .. but I want to know how to do it anyway - mostly for my own interest. Consider the following snippet of code: --- def Get( *names ): if not names: return Non

Re: Accessing __slots__ from C

2008-09-12 Thread Chris
Hrvoje Niksic xemacs.org> writes: ... > Chris users.sourceforge.net> writes: > > >> PyObject_GetAttrString is convenient, but it creates a Python string > >> only so it can intern it (and in most cases throw away the freshly > >> created version). For maximum efficiency, pre-create the string >

Re: Injecting new names into the above frame

2008-09-12 Thread Carsten Haese
Peter Waller wrote: > Dear Pythoners, > > I know this will probably be perceived as 'evil voodoo', and fair > enough: it probably is. I guess it is unpythonic. > > .. but I want to know how to do it anyway - mostly for my own > interest. Well, if you're really just asking out of curiosity, it sh

Checking the boolean value of a collection

2008-09-12 Thread Marco Bizzarri
Hi all. In many parts of my code I've the following schema of code: def isInUseByOutgoingRegistrations(self, archivefolder): for instance in self.findActiveOutgoingRegistrationInstances(): if instance.forbidToClose(archivefolder): return True return

Re: Accessing __slots__ from C

2008-09-12 Thread Hrvoje Niksic
Chris <[EMAIL PROTECTED]> writes: >> In my experience, as long as you're >> accessing simple slots, you should notice a difference. > > (I'm not sure what you mean by a 'simple slot'. I mean a slot defined by __slots__ = slot1, slot2, slot3, ..., without descriptors or specific __getattribute__ c

Re: lacking follow-through

2008-09-12 Thread Aaron "Castironpi" Brady
On Sep 12, 7:23 am, Steve Holden <[EMAIL PROTECTED]> wrote: > castironpi wrote: > > If you are flattered to be compared to an AI you must come from the same > race as Mr. Spock in Star Trek. No, I said 'for my logic to compared'. Speaking of which, I think you excluded the possibility of diligent

Re: Accessing __slots__ from C

2008-09-12 Thread Hrvoje Niksic
Chris <[EMAIL PROTECTED]> writes: >> descr = GetAttrString(cls,"varname"); >> offset = descr->d_member->offset; >> slotvar = (PyObject*)(((char*)obj)+offset) > > Unfortunately, I am inexperienced at this kind of thing, so I wasn't > able to get something working. Maybe someone could tell me what's

Re: Checking the boolean value of a collection

2008-09-12 Thread Diez B. Roggisch
Marco Bizzarri schrieb: Hi all. In many parts of my code I've the following schema of code: def isInUseByOutgoingRegistrations(self, archivefolder): for instance in self.findActiveOutgoingRegistrationInstances(): if instance.forbidToClose(archivefolder):

Re: Checking the boolean value of a collection

2008-09-12 Thread Marco Bizzarri
On Fri, Sep 12, 2008 at 4:09 PM, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > Marco Bizzarri schrieb: >> >> Hi all. >> >> In many parts of my code I've the following schema of code: >> >>def isInUseByOutgoingRegistrations(self, archivefolder): >>for instance in self.findActiveOutgoingR

Re: Accessing __slots__ from C

2008-09-12 Thread Hrvoje Niksic
Hrvoje Niksic <[EMAIL PROTECTED]> writes: > Chris <[EMAIL PROTECTED]> writes: > >>> descr = GetAttrString(cls,"varname"); >>> offset = descr->d_member->offset; >>> slotvar = (PyObject*)(((char*)obj)+offset) >> >> Unfortunately, I am inexperienced at this kind of thing, so I wasn't >> able to get s

Re: Checking the boolean value of a collection

2008-09-12 Thread Diez B. Roggisch
if any(instance.forbitToClose(archivefolder) for instance in self.findActiveOutgoingRegistrationInstances()) Can you clarify where I can find "any"? It seems to me I'm unable to find it... It's part of python2.5. If you don't have that, you can write it your own and stuff it into __builtins_

Re: Checking the boolean value of a collection

2008-09-12 Thread Fredrik Lundh
Marco Bizzarri wrote: Can you clarify where I can find "any"? It seems to me I'm > unable to find it... it's a 2.5 addition. to use this in a "future-compatible" way in 2.3, you can add try: any except NameError: def any(iterable): for element in it

Re: Matching horizontal white space

2008-09-12 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: multipleSpaces = re.compile(u'\\h+') importantTextString = '\n \n \n \t\t ' importantTextString = multipleSpaces.sub("M", importantTextString) what's "\\h" supposed to mean? I would have expected consecutive spaces and tabs to be replaced by M but nothing is bein

Re: Checking the boolean value of a collection

2008-09-12 Thread Marco Bizzarri
On Fri, Sep 12, 2008 at 4:44 PM, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: >>> if any(instance.forbitToClose(archivefolder) for instance in >>> self.findActiveOutgoingRegistrationInstances()) >> >> Can you clarify where I can find "any"? It seems to me I'm unable to find >> it... > > It's part of

Re: Checking the boolean value of a collection

2008-09-12 Thread Marco Bizzarri
On Fri, Sep 12, 2008 at 4:44 PM, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: >>> if any(instance.forbitToClose(archivefolder) for instance in >>> self.findActiveOutgoingRegistrationInstances()) >> >> Can you clarify where I can find "any"? It seems to me I'm unable to find >> it... > > It's part of

setattr in class

2008-09-12 Thread Bojan Mihelac
Hi all - when trying to set some dynamic attributes in class, for example: class A: for lang in ['1', '2']: exec('title_%s = lang' % lang) #this work but is ugly # setattr(A, "title_%s" % lang, lang) # this wont work setattr(A, "title_1", "x") # this work when outside class p

Re: Checking the boolean value of a collection

2008-09-12 Thread Fredrik Lundh
Marco Bizzarri wrote: I would like to make this available to the whole project. I suspect I could put it in the package __init__.py... in that way, the __builtins__ namespace should have it... am I right? the __init__ module for package "foo" defines the contents of the "foo" module; it does

Re: setattr in class

2008-09-12 Thread Fredrik Lundh
Bojan Mihelac wrote: Hi all - when trying to set some dynamic attributes in class, for example: class A: for lang in ['1', '2']: exec('title_%s = lang' % lang) #this work but is ugly # setattr(A, "title_%s" % lang, lang) # this wont work setattr(A, "title_1", "x") # this wo

Re: Checking the boolean value of a collection

2008-09-12 Thread D'Arcy J.M. Cain
On Fri, 12 Sep 2008 17:11:47 +0200 Fredrik Lundh <[EMAIL PROTECTED]> wrote: > The "__builtins__" object is an implementation detail, and shouldn't be > accessed directly. And I hope I don't need to point out that adding > custom builtins nillywilly is a bad idea... Is there ever any advantage t

Re: setattr in class

2008-09-12 Thread Christian Heimes
Bojan Mihelac wrote: I guess A class not yet exists in line 4. Is it possible to achive adding dynamic attributes without using exec? Correct, the class doesn't exist until the end of the class body. You can either do it outside the class definition or you can use a metaclass. Christian --

Re: setattr in class

2008-09-12 Thread Bojan Mihelac
On Sep 12, 5:21 pm, Christian Heimes <[EMAIL PROTECTED]> wrote: > Bojan Mihelac wrote: > > I guess A class not yet exists in line 4. Is it possible to achive > > adding dynamic attributes without using exec? > > Correct, the class doesn't exist until the end of the class body. You > can either do i

Re: setattr in class

2008-09-12 Thread Wojtek Walczak
On Fri, 12 Sep 2008 08:08:18 -0700 (PDT), Bojan Mihelac wrote: > Hi all - when trying to set some dynamic attributes in class, for > example: > > class A: > for lang in ['1', '2']: > exec('title_%s = lang' % lang) #this work but is ugly > # setattr(A, "title_%s" % lang, lang) #

Python a good choice for experimenting with Win32 API?

2008-09-12 Thread Siegfried Heintze
I need to understand some User32.dll functions and I'm making an elaborate GUI so I can easily experiment with different parameters. This is taking a long time. I'm new to python and I'm thinking it would sure be nice to have an interpreter I can type a few lines of code into and test things. (

Re: setattr in class

2008-09-12 Thread Bojan Mihelac
On Sep 12, 5:35 pm, Wojtek Walczak <[EMAIL PROTECTED]> wrote: > On Fri, 12 Sep 2008 08:08:18 -0700 (PDT), Bojan Mihelac wrote: > > Hi all - when trying to set some dynamic attributes in class, for > > example: > > > class A: > >     for lang in ['1', '2']: > >         exec('title_%s = lang' % lang)

Re: Checking the boolean value of a collection

2008-09-12 Thread Fredrik Lundh
D'Arcy J.M. Cain wrote: Is there ever any advantage to having something as a builtin rather than as a regular user method? What difference does it make to the running script? I can see that adding "bar" from module "foo" to "__builtins__" means that you can use "bar()" instead of "foo.bar()".

Re: Checking the boolean value of a collection

2008-09-12 Thread Bruno Desthuilliers
Marco Bizzarri a écrit : (snip) I'm afraid this have another problem for me... [EMAIL PROTECTED]:/var/local/zope28/porting/Products/PAFlow$ python2.3 Python 2.3.5 (#2, Oct 18 2006, 23:04:45) [GCC 4.1.2 20061015 (prerelease) (Debian 4.1.1-16.1)] on linux2 Type "help", "copyright", "credits" or "

Re: Checking the boolean value of a collection

2008-09-12 Thread bearophileHUGS
Marco Bizzarri: > >>> any([x for x in [1, 2, 3]]) > > I mean, I'm afraid I can't use an expression like that without > building a list... not at least in python2.3 Note that you don't need a list comp there: >>> any([x for x in [1, 2, 3]]) True >>> any([1, 2, 3]) True so this may suffice: any(s

Re: Python a good choice for experimenting with Win32 API?

2008-09-12 Thread Mike Driscoll
On Sep 12, 10:36 am, "Siegfried Heintze" <[EMAIL PROTECTED]> wrote: > I need to understand some User32.dll functions and I'm making an elaborate > GUI so I can easily experiment with different parameters. This is taking a > long time. I'm new to python and I'm thinking it would sure be nice to have

Re: lacking follow-through

2008-09-12 Thread Steve Holden
Aaron "Castironpi" Brady wrote: > On Sep 12, 7:23 am, Steve Holden <[EMAIL PROTECTED]> wrote: >> castironpi wrote: >> >> If you are flattered to be compared to an AI you must come from the same >> race as Mr. Spock in Star Trek. > > No, I said 'for my logic to compared'. Speaking of which, I thin

Re: Newbie Question:Please help

2008-09-12 Thread Steve Holden
Karthik Krishnan wrote: > Hi, > > I am a newbie to python and I hope this is not a stupid question. I am > trying to run a main method from a Python command line using the command > shell using the command. > > python main_test.py > > I get the following error. > > > File "", line 1 > python

Re: lacking follow-through

2008-09-12 Thread Fredrik Lundh
Steve Holden wrote: The defence rests. can you please stop quoting that guy, so we don't have to killfile you as well... -- http://mail.python.org/mailman/listinfo/python-list

Re: dict slice in python (translating perl to python)

2008-09-12 Thread Nick Craig-Wood
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Thu, 11 Sep 2008 03:36:35 -0500, Nick Craig-Wood wrote: > > > As an ex-perl programmer and having used python for some years now, I'd > > type the explicit > > > > v1,v2,v3 = mydict['one'], mydict['two'], mydict['two'] # 54 chars > > > > Or mayb

manipulating files within 'for'

2008-09-12 Thread Ben Keshet
Hi Pythoneers, I have a question about a code I wrote with the help of someone. The code below copy a few lines from different files into one file. It works fine as it is given here and generates the new file 'pockets.out' correctly, but says:"py returned exit code 0". However, if I add m

Re: lacking follow-through

2008-09-12 Thread Aahz
In article <[EMAIL PROTECTED]>, Fredrik Lundh <[EMAIL PROTECTED]> wrote: >Steve Holden wrote: >> >> The defence rests. > >can you please stop quoting that guy, so we don't have to killfile you >as well... +1 -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ "Argue f

Which version

2008-09-12 Thread Don
Hi, I'm a reasonably experienced in other languages and have just decided to get my feet wet with Python. But I'm using FC6 which has v2.4.4 installed, is this good enough to start out with or am I likely to encounter bugs that have been fixed in later versions. Don -- http://mail.python.org/mail

Re: Which version

2008-09-12 Thread Eric Wertman
> I'm a reasonably experienced in other languages and have just decided to > get my feet wet with Python. But I'm using FC6 which has v2.4.4 installed, > is this good enough to start out with or am I likely to encounter bugs that > have been fixed in later versions. I'm sure there will be other op

Re: Which version

2008-09-12 Thread Fredrik Lundh
Don wrote: I'm a reasonably experienced in other languages and have just decided to get my feet wet with Python. But I'm using FC6 which has v2.4.4 installed, is this good enough to start out with or am I likely to encounter bugs that have been fixed in later versions. Python 2.4 is definitely

Re: Which version

2008-09-12 Thread Fredrik Lundh
Eric Wertman wrote: The subprocess module is one though footnote: subprocess works on older versions too, and can be trivially installed along with your application under Python 2.2 and 2.3. binary builds for Windows are available here: http://effbot.org/downloads/#subprocess -- http:

Re: manipulating files within 'for'

2008-09-12 Thread Emile van Sebille
Ben Keshet wrote: Hi Pythoneers, I have a question about a code I wrote with the help of someone. The code below copy a few lines from different files into one file. It works fine as it is given here and generates the new file 'pockets.out' correctly, but says:"py returned exit code 0". H

Re: manipulating files within 'for'

2008-09-12 Thread Arnaud Delobelle
On Sep 12, 6:11 pm, Ben Keshet <[EMAIL PROTECTED]> wrote: > Hi Pythoneers, > > I have a question about a code I wrote with the help of someone. The > code below copy a few lines from different files into one file. It works > fine as it is given here and generates the new file 'pockets.out' > correc

Re: manipulating files within 'for'

2008-09-12 Thread Ben Keshet
Emile van Sebille wrote: Ben Keshet wrote: Hi Pythoneers, I have a question about a code I wrote with the help of someone. The code below copy a few lines from different files into one file. It works fine as it is given here and generates the new file 'pockets.out' correctly, but says:"p

Getting Linux partition info programmatically

2008-09-12 Thread python dev
Hello everyone, I am trying to get a list of all the partitions (along with their respective file system types) listed in the /media directory. Does anybody know if there is a way to do this using Python, or do I have to get this information by parsing the output of a Linux command? Thanks in ad

Re: GUI programming with python

2008-09-12 Thread Al Dykes
In article <[EMAIL PROTECTED]>, Alan Franzoni <[EMAIL PROTECTED]> wrote: >zamil was kind enough to say: > >[cut] > >If your needs are very basic, you can stick with the tk module that comes >with python. It's not really feature-packed, but it's maintained and pretty >cross-platform. OK, what are

Re: Getting Linux partition info programmatically

2008-09-12 Thread Christian Heimes
python dev wrote: Hello everyone, I am trying to get a list of all the partitions (along with their respective file system types) listed in the /media directory. Does anybody know if there is a way to do this using Python, or do I have to get this information by parsing the output of a Linux co

Need help with the 'transport' for setting the header while calling a function at server side

2008-09-12 Thread Usman Ajmal
I am getting an Internal Server Error 500 when i run my client code. I am trying to call a function at the server side which for now only returns a string. Meanwhile this calling i also set the header of HTTP request. Following are my client and server code. Am i doing something wrong? #-

Re: manipulating files within 'for'

2008-09-12 Thread bearophileHUGS
Ben Keshet: > ...wrong. I thought I should omit the comma and didn't put it. I guess > that stating the obvious should be the first attempt with beginners like > me. Thanks for thinking about it (it's running perfect now). In CLisp, Scheme etc, lists such commas aren't necessary, but in Python

Re: Python on Windows XP 64-bit: python not found in registry

2008-09-12 Thread Martin v. Löwis
> Anybody here that had the same problem and solved it? Did you install the 32-bit or the 64-bit installer? If the 64-bit installer, did you also install 32-bit or 64-bit installers for iPython, PIL, and easy_install? If you try to use 32-bit extensions or installers to locate a 64-bit Python, t

book example confusion

2008-09-12 Thread byron
I am reading o'reilly's learning python (great book), but i came across an example (pg 291, pdf) that I am not quite understanding the reasoning for the author's explanation: if f1() or f2(): The author states that do to the nature of that expression, if f1() returns True, f2() will not be evalua

Re: book example confusion

2008-09-12 Thread Bruno Desthuilliers
byron a écrit : I am reading o'reilly's learning python (great book), but i came across an example (pg 291, pdf) that I am not quite understanding the reasoning for the author's explanation: if f1() or f2(): The author states that do to the nature of that expression, if f1() returns True, f2()

Re: book example confusion

2008-09-12 Thread Chris Rebert
Note the parentheses after f1 and f2 in the second example. That's what calls the functions and causes them to be evaluated and run. - Chris Sent from my iPod On Sep 12, 2008, at 12:36 PM, byron <[EMAIL PROTECTED]> wrote: I am reading o'reilly's learning python (great book), but i came acro

Re: book example confusion

2008-09-12 Thread John Machin
On Sep 13, 5:36 am, byron <[EMAIL PROTECTED]> wrote: > I am reading o'reilly's learning python (great book), but i came > across an example (pg 291, pdf) that I am not quite understanding the > reasoning for the author's explanation: > > if f1() or f2(): > > The author states that do to the nature

Re: manipulating files within 'for'

2008-09-12 Thread Matt Nordhoff
[EMAIL PROTECTED] wrote: > Ben Keshet: >> ...wrong. I thought I should omit the comma and didn't put it. I guess >> that stating the obvious should be the first attempt with beginners like >> me. Thanks for thinking about it (it's running perfect now). > > In CLisp, Scheme etc, lists such comma

Re: GUI programming with python

2008-09-12 Thread Stef Mientki
Al Dykes wrote: In article <[EMAIL PROTECTED]>, Alan Franzoni <[EMAIL PROTECTED]> wrote: zamil was kind enough to say: [cut] If your needs are very basic, you can stick with the tk module that comes with python. It's not really feature-packed, but it's maintained and pretty cross-platform.

Re: Matching horizontal white space

2008-09-12 Thread John Machin
On Sep 13, 12:52 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > multipleSpaces = re.compile(u'\\h+') > > > importantTextString = '\n  \n  \n \t\t  ' > > importantTextString = multipleSpaces.sub("M", importantTextString) > > what's "\\h" supposed to mean? Match *h*orizo

Re: book example confusion

2008-09-12 Thread byron
On Sep 12, 3:51 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Sep 13, 5:36 am, byron <[EMAIL PROTECTED]> wrote: > > > > > I am reading o'reilly's learning python (great book), but i came > > across an example (pg 291, pdf) that I am not quite understanding the > > reasoning for the author's expla

Re: GUI programming with python

2008-09-12 Thread Mike Driscoll
On Sep 12, 1:33 pm, [EMAIL PROTECTED] (Al Dykes) wrote: > In article <[EMAIL PROTECTED]>, > Alan Franzoni  <[EMAIL PROTECTED]> wrote: > > >zamil was kind enough to say: > > >[cut] > > >If your needs are very basic, you can stick with the tk module that comes > >with python. It's not really feature-

Re: manipulating files within 'for'

2008-09-12 Thread bearophileHUGS
Matt Nordhoff: > It's useful when wrapping a line. For lack of better lorem ipsum: > > whatever = some_function("Your mistake is caused by Python not " > "following one of its general rules:\n\n" > "Explicit is better than implicit.") > > You can a

Re: manipulating files within 'for'

2008-09-12 Thread bearophileHUGS
Matt Nordhoff: > BTW, I could easily be wrong, but I think C behaves the same way as Python. C syntax has many traps that are much better out of modern languages like Python/D/etc. I think C has that feature because it lacks an operator for string concatenation, while both Python and D have one (

lxml build error in sun

2008-09-12 Thread Owen Zhang
I am trying to build lxml package in SunOS 5.10. I got the following errors. Does anybody know why? $ python setup.py build Building lxml version 2.1. NOTE: Trying to build without Cython, pre-generated 'src/lxml/ lxml.etree.c' needs to be available. Using build configuration of libxslt 1.1.7 Buil

Re: String to hexadecimal conversion

2008-09-12 Thread imageguy
On Sep 8, 5:05 am, Praveena P <[EMAIL PROTECTED]> wrote: > Hi folks, > > I am new to Python... so am not too sure about how the type conversion > works. > > I have to read a file that contains hexadecimal data and use the data > further to do some arithmetic calculations. > A sample of the input is

Re: setattr in class

2008-09-12 Thread Arnaud Delobelle
On Sep 12, 4:30 pm, Bojan Mihelac <[EMAIL PROTECTED]> wrote: > On Sep 12, 5:21 pm, Christian Heimes <[EMAIL PROTECTED]> wrote: > > > Bojan Mihelac wrote: > > > I guess A class not yet exists in line 4. Is it possible to achive > > > adding dynamic attributes without using exec? > > > Correct, the c

Re: Which version

2008-09-12 Thread Don
Eric,Fredrik, Many thanks for your prompt advice, it was a 'better safe than sorry' type of question. Don -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and Open Office

2008-09-12 Thread Gary Herron
Greg Lindstrom wrote: Hello, I would like to create and manipulate Open Office documents using Python. I have found then UNO Python page and odfpy modules which seem to be exactly what I need. The odfpy manual is, to me, a confusing list of objects and methods (it's an impressive list!), bu

Re: Accessing __slots__ from C

2008-09-12 Thread Carl Banks
On Sep 12, 10:01 am, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > Chris <[EMAIL PROTECTED]> writes: > >> descr = GetAttrString(cls,"varname"); > >> offset = descr->d_member->offset; > >> slotvar = (PyObject*)(((char*)obj)+offset) > > > Unfortunately, I am inexperienced at this kind of thing, so I was

Re: Gateway to python-list is generating bounce messages.

2008-09-12 Thread Matt Nordhoff
Steven D'Aprano wrote: > On Thu, 11 Sep 2008 17:27:33 +0200, Sjoerd Mullender wrote: > >> When mail messages bounce, the MTA (Message Transfer Agent--the program >> that handles mail) *should* send the bounce message to whatever is in >> the Sender header, and only if that header does not exist, s

Re: Python a good choice for experimenting with Win32 API?

2008-09-12 Thread sturlamolden
> (1) Would CPython be a good choice for this? How about iron python? How > about Jython (probably not). You can use CPython without any problems. Alternatives are pywin32, ctypes, cython, pyrex, Python C API. You can use .NET platform invoke from IronPython. You can use JNI from Jython, or an

Re: setattr in class

2008-09-12 Thread Michael Palmer
On Sep 12, 11:08 am, Bojan Mihelac <[EMAIL PROTECTED]> wrote: > Hi all - when trying to set some dynamic attributes in class, for > example: > > class A: > for lang in ['1', '2']: > exec('title_%s = lang' % lang) #this work but is ugly > # setattr(A, "title_%s" % lang, lang) # t

Re: GUI programming with python

2008-09-12 Thread sturlamolden
On Sep 12, 8:33 pm, [EMAIL PROTECTED] (Al Dykes) wrote: > OK, what are my choices for an IDE/GUI development tool that runs on XP? That depends on the GUI toolkit you are using. My suggestion: CPython with wxPython: wxFormBuilder Cpython with PyQt: BlackAdder CPython with PyGTK: GLADE 3 Jytho

Re: conditional install/distribution

2008-09-12 Thread i3dmaster
On Sep 11, 11:07 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > i3dmasterschrieb: > > > Is there a feature in distutils or easy_install to specify what > > version of python that the target package can be installed? For > > example, if a package has a module that only needed if the python > >

Re: Gateway to python-list is generating bounce messages.

2008-09-12 Thread Grant Edwards
On 2008-09-12, Matt Nordhoff <[EMAIL PROTECTED]> wrote: > I think you misunderstand. He's referring to the Sender > header, not the From header. The messages the listbot sends > out have a Sender header of > "[EMAIL PROTECTED]" (supposing > the subscriber's email address is [EMAIL PROTECTED]). Bou

  1   2   >