Re: xml aggregator

2006-07-10 Thread Gerard Flanagan
> Gerard Flanagan wrote: > > Gerard Flanagan wrote: > > > kepioo wrote: > > > > Hi all, > > > > > > > > I am trying to write an xml aggregator, but so far, i've been failing > > > > miserably. > > > > > > >

Re: xml aggregator

2006-07-10 Thread Gerard Flanagan
kepioo wrote: > Thank you so much, it works and it rocks ! > Great! Glad I could help. > bad thing i need ot figure out is why mozilla cannot parse my xsl > sheet, but it works in IE ( most of my users are using IE) > you could try transforming the xml on the server and send straight HTML to th

Re: unpaking sequences of unknown length

2006-08-27 Thread Gerard Flanagan
Anthra Norell wrote: > Hi, > >I keep working around a little problem with unpacking in cases in which I > don't know how many elements I get. Consider this: > > def tabulate_lists (*arbitray_number_of_lists): > table = zip (arbitray_number_of_lists) > for record

Re: Building Python Based Web Application

2006-09-09 Thread Gerard Flanagan
James Stroud wrote: > Hello All, > > I am interested in setting up a modest invoicing system for some > consulting I am doing. I like the idea of managing this on the web and > creating invoices and printing them from a browser. However, I'm not > really sure where to start. I've played with some C

Re: Problems with email.Generator.Generator

2006-09-11 Thread Gerard Flanagan
Chris Withers wrote: > > Now, I want to know what I'm supposed to do when I have unicode source > and want it to end up as either a text/plain or text/html mime part. > > Is there a how-to for this anywhere? The email package's docs are short > on examples involving charsets, unicode and the like

Re: Running Python script from C++ code(.NET)

2006-09-23 Thread Gerard Flanagan
volcano wrote: > Hello, folks! > A trivial question - I have a working Python script that I have to > invoke from C++ code. No fancy stuff - just run the whole script with > its parameters. No callbacks, no signalling - nada, just > stupid,primitive, straightforward call. > > And while there is a

Re: Running Python script from C++ code(.NET)

2006-09-23 Thread Gerard Flanagan
volcano wrote: > Gerard Flanagan wrote: > > volcano wrote: > > > Hello, folks! > > > A trivial question - I have a working Python script that I have to > > > invoke from C++ code. No fancy stuff - just run the whole script with > > > its paramet

Re: Running Python script from C++ code(.NET)

2006-09-27 Thread Gerard Flanagan
volcano wrote: > volcano wrote: > > Hello, folks! > > A trivial question - I have a working Python script that I have to > > invoke from C++ code. No fancy stuff - just run the whole script with > > its parameters. No callbacks, no signalling - nada, just > > stupid,primitive, straightforward cal

Re: Running Python script from C++ code(.NET)

2006-09-27 Thread Gerard Flanagan
volcano wrote: > volcano wrote: > > Hello, folks! > > A trivial question - I have a working Python script that I have to > > invoke from C++ code. No fancy stuff - just run the whole script with > > its parameters. No callbacks, no signalling - nada, just > > stupid,primitive, straightforward cal

Re: __init__ style questions

2006-10-02 Thread Gerard Flanagan
Will McGugan wrote: > I am writting a Vector3D class as a teaching aid (not for me, for > others), and I find myself pondering over the __init__ function. I want > it to be as easy to use as possible (speed is a secondary > consideration). > > Heres the __init__ function I have at the moment. > >

Re: python html rendering

2006-10-04 Thread Gerard Flanagan
Fredrik Lundh wrote: > Pierre Imbaud wrote: > > > I rather thought of some module built on python parser, generating html > > or xml, ideally customizable. > > see "colorizer.py" and "element_colorizer.py" in this directory: > > http://svn.effbot.python-hosting.com/stuff/sandbox/pythondoc >

Re: Python work in UK

2006-11-24 Thread Gerard Flanagan
Will McGugan wrote: > Hi, > > I'd love to work in Python, for the sake of my blood pressure, but there > doesnt seem to be that many jobs that look for Python as the main skill. > I use Python at work from time to time, and occasionaly get to spend > several days on a Python project but the major

Re: How to do a Http HEAD requests

2006-12-12 Thread Gerard Flanagan
Soni Bergraj wrote: > Hello list, > I was just wondering if there is a more convenient way of doing a Http > HEAD requests then the socket module? > > Any ideas? I recently used this: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/286225 Gerard -- http://mail.python.org/mailman/list

Re: wrapping problem with old-style class

2006-12-19 Thread Gerard Flanagan
manstey wrote: > The ipo class has three basic methods, namely, get, set, and > run_obj_method (which takes the Cache class method, as its first > argument, and the list of its arguments as the second argument) > > e.g. > >>> CacheClass=ipo() > >>> CacheClass.set('Name','John') > >>> valName = Ca

Re: permutations - fast & with low memory consumption?

2006-12-19 Thread Gerard Flanagan
Christian Meesters wrote: > Hi, > > I'd like to hack a function which returns all possible permutations as lists > (or tuples) of two from a given list. So far, I came up with this solution, > but it turned out to be too slow for the given problem, because the list > passed ("atomlist") can be so

Re: Iterate through list two items at a time

2007-01-02 Thread Gerard Flanagan
Dave Dean wrote: > Hi all, > I'm looking for a way to iterate through a list, two (or more) items at a > time. Basically... > > myList = [1,2,3,4,5,6] > > I'd like to be able to pull out two items at a time - simple examples would > be: > Create this output: > 1 2 > 3 4 > 5 6 > > Create this

Re: Excel and TrackChanges

2006-02-15 Thread Gerard Flanagan
pierre_py wrote: > I have a problem with pycom automation with excel. > If i use the following in my excel_wrapper: > """ > self.Workbook.Save() > self.Workbook.HighlightChangesOptions(When=1) > self.Workbook.ListChangesOnNewSheet = True > """ > I don't get any history worksheet. If i use 2 (xlAllC

Re: Merging two lists of data (Pythonic way)

2006-02-17 Thread Gerard Flanagan
Dave Hansen wrote: > On Thu, 16 Feb 2006 12:51:24 -0800 in comp.lang.python, "SMB" > <[EMAIL PROTECTED]> wrote: > > > > >"Jonathan Gardner" <[EMAIL PROTECTED]> wrote in message > >news:[EMAIL PROTECTED] > >> codes = map(lambda x: x[0], list1) > >> for d in list2: > >> if d['code'] in codes: > >>

Re: 2-dimensional data structures

2006-02-19 Thread Gerard Flanagan
anthonyberet wrote: > I want to work on a sudoku brute-forcer, just for fun. >... > Thanks for the advice (to everyone in the thread). > I think I will go with nested lists. > However, I am running into a conceptual problem. > My approach will be firstly to remove all the impossible digits for a >

Re: Processing text using python

2006-02-20 Thread Gerard Flanagan
nuttydevil wrote: > Hey everyone! I'm hoping someone will be able to help me, cause I > haven't had success searching on the web so far... I have large chunks > of text ( all in a long string) that are currently all in separate > notebook files. I want to use python to read these strings of text, >

Re: algorithm, optimization, or other problem?

2006-02-21 Thread Gerard Flanagan
Brian Blais wrote: > Hello, > > I am trying to translate some Matlab/mex code to Python, for doing neural > simulations. This application is definitely computing-time limited, and I > need to > optimize at least one inner loop of the code, or perhaps even rethink the > algorithm. >The proced

Re: algorithm, optimization, or other problem?

2006-02-21 Thread Gerard Flanagan
Gerard Flanagan wrote: > Brian Blais wrote: > > Hello, > > > > I am trying to translate some Matlab/mex code to Python, for doing neural > > simulations. This application is definitely computing-time limited, and I > > need to > > optimize at least one

Re: No

2006-02-22 Thread Gerard Flanagan
Gaz wrote: > (the Input type = FILE is in the field) > > please check this out > > import ftplib > import os > > ... > > def upload(ftp, file): > ext = os.path.splitext(file)[1] > if ext in (".txt", ".htm", ".html"): > ftp.storlines("STOR " + file, open(file)) >

Re: What's up with this code?

2006-02-22 Thread Gerard Flanagan
Gregory Petrosyan wrote: > Hello, it's me again. > I am trying to optimise small module for working with polynomials, and > I have encountered problem: new, optimised, code, doesn't work in some > specific case. Here's the old version of the code: > > (3x^2 + 2x + 1 <=> poly([3, 2, 1]), btw) > >

Re: Psychic bug

2006-02-23 Thread Gerard Flanagan
Jennifer Hallinan wrote: > Hi, > > I have a mutate function for a genetic algorithm which is giving me > odd results. I suspect I'm missing somthing really simple, so I'd be > grateful for any suggestions. Basically, when I comment out the line > which is commented out below, it works fine (althoug

Re: Detec nonascii in a string

2006-02-23 Thread Gerard Flanagan
Sebastian Bassi wrote: > Hello, > > How do I detect non-ascii letters in a string? > I want to detect the condition that a string have a letter that is not > here: string.ascii_letters > > Best regards, > SB. > > -- > Bioinformatics news: http://www.bioinformatica.info > Lriser: http://www.linspire

Re: a little more help with python server-side scripting

2006-02-23 Thread Gerard Flanagan
John Salerno wrote: > > Ok, seems like the verdict is that the server doesn't have mod_python > nor does it detect the .psp extension. It can, however, detect the .py > extension. But does this mean I can simply include Python code in my > HTML files, and then give my HTML files a .py extension? N

Re: a little more help with python server-side scripting

2006-02-24 Thread Gerard Flanagan
John Salerno wrote: > Kent Johnson wrote: > > John Salerno wrote: > >> Magnus Lycka wrote: > >> > >>> The other option is ASP. You have been given information about > >>> that already. Be aware that ASP does not imply VBScript. You can > >>> use Python in ASP as long as that's enabled. It seems to

TypeError when subclassing 'list'

2006-02-26 Thread Gerard Flanagan
Hello all Could anyone shed any light on the following Exception? The code which caused it is below. Uncommenting the 'super' call in 'XmlNode' gives the same error. If I make XmlNode a subclass of 'object' rather than 'list' then the code will run. Thanks in advance. Exception: Traceback (mos

Re: TypeError when subclassing 'list'

2006-02-26 Thread Gerard Flanagan
Steve Juranich wrote: > Gerard Flanagan wrote: > > > Hello all > > > > Could anyone shed any light on the following Exception? The code which > > caused it is below. Uncommenting the 'super' call in 'XmlNode' gives > > the same err

Re: TypeError when subclassing 'list'

2006-02-27 Thread Gerard Flanagan
Simon Percivall wrote: > The error you're seeing is because you've rebound 'list' to something > else. Try putting "list = type([])" somewhere above your code. That's it! I had rebound 'list' earlier (in error), and though I deleted the code it must have been "remembered" somehow. Restarting Pyt

Accessing 'mangled' class attrbutes

2006-03-01 Thread Gerard Flanagan
Hello all I would like to do the following: from elementtree.SimpleXMLWriter import XMLWriter class HtmlWriter(XMLWriter, object): def write_raw(self, text): super( HtmlWriter, self ).flush() super( HtmlWriter, self ).__write(text) but because of the name-mangling

Re: Accessing 'mangled' class attrbutes

2006-03-01 Thread Gerard Flanagan
Steve Juranich wrote: > Gerard Flanagan wrote: > > > I would like to do the following: > > > > from elementtree.SimpleXMLWriter import XMLWriter > > > > class HtmlWriter(XMLWriter, object): > > def write_raw(self, text): >

Re: Accessing 'mangled' class attrbutes

2006-03-01 Thread Gerard Flanagan
[EMAIL PROTECTED] wrote: > >>Is there any simple way round this situation in general? > > It might be safer to use composition instead of inheritance in this > case. Assuming that XMLWriter has a write method to write what you > want, you could hold a reference to an XMLWriter within your class and

Re: Accessing 'mangled' class attrbutes

2006-03-01 Thread Gerard Flanagan
Steve Juranich wrote: > Gerard Flanagan wrote: > > > I tried that Steve but it didn't work, and i don't think I can do what > > I want in any case. There is no method '__write' in the base class, it > > is only declared as an instance attribute

setattr question

2006-03-02 Thread Gerard Flanagan
Hello I have the following code: builder.py # class HtmlBuilder(object): @staticmethod def page(title=''): return HtmlPage(title) @staticmethod def element(tag, text=None, **attribs): return HtmlElement(tag, text, **attribs) @staticmethod de

Re: setattr question

2006-03-02 Thread Gerard Flanagan
bruno at modulix wrote: > Gerard Flanagan wrote: > > Hello > > > > I have the following code: > > > > builder.py # > > class HtmlBuilder(object): > > > > @staticmethod > > def page(title=''): > >

Re: setattr question

2006-03-02 Thread Gerard Flanagan
Fredrik Lundh wrote: > Gerard Flanagan wrote: > > > I have the following code: > > > > builder.py # > > class HtmlBuilder(object): > > > > @staticmethod > > def page(title=''): > > return HtmlPage(tit

Re: setattr question

2006-03-03 Thread Gerard Flanagan
bruno at modulix wrote: [...] > > I don't know this HtmlElement class, nor where it comes from. > 'to_string()' (or is it toString() ?) is javaish. The pythonic idiom for > this is implementing the __str__() method and calling str(obj) on the > obj (which will call obj.__str__()). Hence my (bad) gu

Re: setattr question

2006-03-03 Thread Gerard Flanagan
bruno at modulix wrote: > Gerard Flanagan wrote: > > The functions were kind of related > > and meaningless outside the module they were declared - > > FWIW (and from the snippet I saw), these functions are useless even in > the module !-) > ok, ok... :-) > Unless

Re: how to record how long i use the intenet

2006-03-04 Thread Gerard Flanagan
[EMAIL PROTECTED] wrote: > use python > use ADSL > use windows XP > i want to record the time when i get on the internet and off the > internet > into a txt file > HOW? http://en.wikipedia.org/wiki/Water_clock HTH Gerard -- http://mail.python.org/mailman/listinfo/python-list

Re: what am I missing (syntax error)

2006-03-05 Thread Gerard Flanagan
orangeDinosaur wrote: > Here's a section of code: > > for x in occupants: > if x not in uniqueUsers and not in staff: > uniqueUsers.append(x) > elif x in staff and not in uniqueStaff: > uniqueStaff.append(x) > > When I try to import the module with th

Re: Separating elements from a list according to preceding element

2006-03-05 Thread Gerard Flanagan
Rob Cowie wrote: > I'm having a bit of trouble with this so any help would be gratefully > recieved... > > After splitting up a url I have a string of the form > 'tag1+tag2+tag3-tag4', or '-tag1-tag2' etc. The first tag will only be > preceeded by an operator if it is a '-', if it is preceded by n

Re: Separating elements from a list according to preceding element

2006-03-05 Thread Gerard Flanagan
Gerard Flanagan wrote: > Rob Cowie wrote: > > I'm having a bit of trouble with this so any help would be gratefully > > recieved... > > > > After splitting up a url I have a string of the form > > 'tag1+tag2+tag3-tag4', or '-tag1-tag2' et

Re: Separating elements from a list according to preceding element

2006-03-05 Thread Gerard Flanagan
James Stroud wrote: > Gerard Flanagan wrote: > > Rob Cowie wrote: > > > >>I'm having a bit of trouble with this so any help would be gratefully > >>recieved... > >> > >>After splitting up a url I have a string of the form > >>'

Re: Separating elements from a list according to preceding element

2006-03-05 Thread Gerard Flanagan
Alex Martelli wrote: > Gerard Flanagan <[EMAIL PROTECTED]> wrote: > ... > > a = [ '+', 'tag1', '+', 'tag2', '-', 'tag3', '+', 'tag4' ] > > > > import itertools > > > > b

Re: a good algo to do this

2006-03-06 Thread Gerard Flanagan
[EMAIL PROTECTED] wrote: > hi > i need to do something like this > eg given a number (as a string) = "123" > there are a few combination i want to find with this string, ie > "132","321","231","312" and "213". so there are 6 combinations > altogether. i remember there's a formula for this, but for

Re: a good algo to do this

2006-03-06 Thread Gerard Flanagan
Gerard Flanagan wrote: > [EMAIL PROTECTED] wrote: > > hi > > i need to do something like this > > eg given a number (as a string) = "123" > > there are a few combination i want to find with this string, ie > > "132","321","

How to do this with groupby (or otherwise)? (Was: iterblocks cookbook example)

2007-06-04 Thread Gerard Flanagan
On Jun 2, 10:47 pm, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > On Jun 2, 10:19 am, Steve Howell <[EMAIL PROTECTED]> wrote: > > > George Sakkis produced the following cookbook recipe, > > which addresses a common problem that comes up on this > > mailing list: > > ISTM, this is a common mailing

Re: How to do this with groupby (or otherwise)? (Was: iterblocks cookbook example)

2007-06-04 Thread Gerard Flanagan
On Jun 4, 1:52 pm, Gerard Flanagan <[EMAIL PROTECTED]> wrote: > On Jun 2, 10:47 pm, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > > > > On Jun 2, 10:19 am, Steve Howell <[EMAIL PROTECTED]> wrote: > > > > George Sakkis produced the following

Re: howto obtain directory where current (running) py-file is placed?

2007-06-07 Thread Gerard Flanagan
On Jun 7, 8:39 am, dmitrey <[EMAIL PROTECTED]> wrote: > Hi all, > I guess this question was asked many times before, but I don't know > keywords for web search. > > Thank you in advance, D. import os d1 = os.path.dirname(__file__) d2 = os.path.dirname(os.__file__) print d1 print d2 -- http://m

Re: howto obtain directory where current (running) py-file is placed?

2007-06-07 Thread Gerard Flanagan
On Jun 7, 1:19 pm, dmitrey <[EMAIL PROTECTED]> wrote: > On Jun 7, 10:18 am, Gerard Flanagan <[EMAIL PROTECTED]> wrote:> On Jun 7, > 8:39 am, dmitrey <[EMAIL PROTECTED]> wrote: > > Thank you. > And what is the simplest way (without split/join, if exist) to

Re: howto obtain directory where current (running) py-file is placed?

2007-06-08 Thread Gerard Flanagan
On Jun 8, 1:01 am, Stef Mientki <[EMAIL PROTECTED]> wrote: > Gerard Flanagan wrote: > > On Jun 7, 8:39 am, dmitrey <[EMAIL PROTECTED]> wrote: > >> Hi all, > >> I guess this question was asked many times before, but I don't know > >> ke

Re: How to format a string from an array?

2007-06-13 Thread Gerard Flanagan
On Jun 13, 11:11 am, Allen <[EMAIL PROTECTED]> wrote: > a = range(256) > I want to output the formated string to be: > 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f > 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f > > f

Re: How to format a string from an array?

2007-06-14 Thread Gerard Flanagan
On Jun 13, 11:11 am, Allen <[EMAIL PROTECTED]> wrote: > a = range(256) > I want to output the formated string to be: > 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f > 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f > > f

Re: Generator for k-permutations without repetition

2007-07-04 Thread Gerard Flanagan
On Jul 4, 1:22 pm, bullockbefriending bard <[EMAIL PROTECTED]> wrote: > I was able to google a recipe for a k_permutations generator, such > that i can write: > > x = range(1, 4) # (say) > [combi for combi in k_permutations(x, 3)] => > > [[1, 1, 1], [1, 1, 2], [1, 1, 3], [1, 2, 1], [1, 2, 2], [1,

Re: Re-raising exceptions with modified message

2007-07-06 Thread Gerard Flanagan
On Jul 6, 12:18 am, Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > Sorry for the soliloquy, but what I am really using is the following so > that the re-raised excpetion has the same type: > > def PoliteException(e): > class PoliteException(e.__class__): > def __init__(self, e): >

Re: Compiling python2.5 on IBM AIX

2007-07-16 Thread Gerard Flanagan
On Jul 16, 12:29 pm, [EMAIL PROTECTED] wrote: > hi, > > I'm trying to make a local install of python 2.5 on AIX and I'm > getting some trouble with _curses. > > Here is how I tried to compile it : > > export BASE=/usr/local/python251 > > cd Python.2.5.1 > ./configure --prefix=${BASE}/\ > LD

Re: Compiling python2.5 on IBM AIX

2007-07-16 Thread Gerard Flanagan
On Jul 16, 12:29 pm, [EMAIL PROTECTED] wrote: > hi, > > I'm trying to make a local install of python 2.5 on AIX and I'm > getting some trouble with _curses. > > Here is how I tried to compile it : > > export BASE=/usr/local/python251 > > cd Python.2.5.1 > ./configure --prefix=${BASE}/\ > LD

Re: what python technology for my app?

2007-04-27 Thread Gerard Flanagan
On Apr 27, 12:18 pm, Chris <[EMAIL PROTECTED]> wrote: > I have an database containing lots of numerical data. I want to write a > browser based interface that will allow selection of various key > parameters and yield tables, plots and/or printouts of the data > according to the selections. Ultimat

Re: Splitting a quoted string.

2007-05-16 Thread Gerard Flanagan
On May 16, 12:42 pm, mosscliffe <[EMAIL PROTECTED]> wrote: > I am looking for a simple split function to create a list of entries > from a string which contains quoted elements. Like in 'google' > search. > > eg string = 'bob john "johnny cash" 234 june' > > and I want to have a list of ['bob', '

Re: Newbie Question: Getting a list of files

2007-05-16 Thread Gerard Flanagan
On May 16, 2:12 am, Brian <[EMAIL PROTECTED]> wrote: > How do I, in Python, obtain a recursive list of files in a specified > directory, including the subdirectories, etc? import os def iter_dirs(root, dirs=False): stack = [root] while stack: dir = stack.pop(0) for f in (

Re: extra xml header with ElementTree?

2007-05-25 Thread Gerard Flanagan
On May 25, 3:55 pm, "Tim Arnold" <[EMAIL PROTECTED]> wrote: > Hi, I'm using ElementTree which is wonderful. I have a need now to write out > an XML file with these two headers: > > > > My elements have the root named tocbody and I'm using: > newtree = ET.ElementTree(tocbody) > newtree.write(fname

Re: multiline regular expression (replace)

2007-05-29 Thread Gerard Flanagan
On May 29, 11:03 am, Zdenek Maxa <[EMAIL PROTECTED]> wrote: > Hi all, > > I would like to perform regular expression replace (e.g. removing > everything from within tags in a XML file) with multiple-line pattern. > How can I do this? > > where = open("filename").read() > multilinePattern = "^

Re: Awkward format string

2007-08-01 Thread Gerard Flanagan
On Aug 1, 6:11 pm, beginner <[EMAIL PROTECTED]> wrote: > Hi, > > In order to print out the contents of a list, sometimes I have to use > very awkward constructions. For example, I have to convert the > datetime.datetime type to string first, construct a new list, and then > send it to print. The fo

Re: Awkward format string

2007-08-02 Thread Gerard Flanagan
On Aug 1, 11:52 pm, Ian Clark <[EMAIL PROTECTED]> wrote: > Gerard Flanagan wrote: > > (snip) > > > def tostring(data): > > return tuple(strftime(x) for x in data[:2]) + data[2:] > > Hrmm, not sure that having a function named tostring() that returns a >

Re: ploting issues in program

2007-08-16 Thread Gerard Flanagan
On Aug 16, 9:48 am, yadin <[EMAIL PROTECTED]> wrote: > hi every one! > > can you please help me to fix these polar plot in db's > so that the center is at the minimun negative number in voltagedb > about [-50] > and the maximun is at zero and how can i see values on the axis like > showing that the

Re: C# and Python

2007-08-21 Thread Gerard Flanagan
On Aug 21, 12:01 pm, subeen <[EMAIL PROTECTED]> wrote: > Hi, > I am a newcomer in Python. I am going to write a small Python > application that will run in windows xp. This application needs to > have GUI. Is it possible to make a C# application using visual studio > 2005 that will call the python

Re: tempfile.mkstemp and os.fdopen

2007-08-29 Thread Gerard Flanagan
On Aug 28, 7:55 pm, billiejoex <[EMAIL PROTECTED]> wrote: > Hi there. > I'm trying to generate a brand new file with a unique name by using > tempfile.mkstemp(). > In conjunction I used os.fdopen() to get a wrapper around file > properties (write & read methods, and so on...) but 'name' attribute >

Any module to parse httpd.conf?

2007-03-06 Thread Gerard Flanagan
Hello, Does anyone know of an existing module to parse httpd.conf files? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: catching exceptions from an except: block

2007-03-08 Thread Gerard Flanagan
On Mar 7, 7:32 pm, "Arnaud Delobelle" <[EMAIL PROTECTED]> wrote: > Hi all, > > Imagine I have three functions a(x), b(x), c(x) that each return > something or raise an exception. Imagine I want to define a function > that returns a(x) if possible, otherwise b(x), otherwise c(x), > otherwise raise

Re: catching exceptions from an except: block

2007-03-08 Thread Gerard Flanagan
On Mar 8, 10:31 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Thu, 08 Mar 2007 06:17:37 -0300, Gerard Flanagan > <[EMAIL PROTECTED]> escribió: > > > @onfail(False) > > def a(x): > > if x == 1: > > return 'function

Re: catching exceptions from an except: block

2007-03-09 Thread Gerard Flanagan
On Mar 9, 9:56 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 09 Mar 2007 04:49:59 -0300, Gerard Flanagan > <[EMAIL PROTECTED]> escribió: > > > Another version: > > > import exceptions > > As back in time as I could go (Python 1.5),

Re: catching exceptions from an except: block

2007-03-09 Thread Gerard Flanagan
On Mar 9, 11:57 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 09 Mar 2007 07:30:20 -0300, Gerard Flanagan > <[EMAIL PROTECTED]> escribió: > > >> There is a serious flaw on this approach, the function can't return any > >> false

Re: number generator

2007-03-09 Thread Gerard Flanagan
On Mar 9, 4:17 pm, "cesco" <[EMAIL PROTECTED]> wrote: > On Mar 9, 3:51 pm, Paul Rubin wrote: > > > "cesco" <[EMAIL PROTECTED]> writes: > > > I have to generate a list of N random numbers (integer) whose sum is > > > equal to M. If, for example, I have to generate 5 random

Re: programmatically manipulation environment variables of the calling shell

2007-03-12 Thread Gerard Flanagan
On Mar 12, 11:33 am, "Maxim Veksler" <[EMAIL PROTECTED]> wrote: > Hello list, > > I'm trying to write a python script that would allow me to manipulate > shell variables of the calling shell. I'm trying to write some logic > that would know to add LD_LIBRARY_PATH to the users environment. > > In ba

How to capture environment state after running a shell script.

2007-03-13 Thread Gerard Flanagan
Hello, I have a third party shell script which updates multiple environment values, and I want to investigate (and ultimately capture to python) the environment state after the script has run. But running the script as a child process only sets values for that process, which are lost after executi

Re: most complete xml package for Python?

2007-03-13 Thread Gerard Flanagan
On Mar 13, 1:43 pm, "metaperl" <[EMAIL PROTECTED]> wrote: > Without even checking them all out, I'm thinking the Amara XML Toolkit > must be the most feature-packed. The developers are readily available > on IRC for support and they seem to make regular releases. > > As a meld3 user, I have been us

Re: How to capture environment state after running a shell script.

2007-03-14 Thread Gerard Flanagan
On Mar 13, 7:54 pm, [EMAIL PROTECTED] wrote: > On Mar 13, 5:57 am, "Gerard Flanagan" <[EMAIL PROTECTED]> wrote: > > > Hello, > > > I have a third party shell script which updates multiple environment > > values, and I want to investigate (and ultimately c

Re: Idiom for running compiled python scripts?

2007-03-23 Thread Gerard Flanagan
On Mar 23, 8:30 am, Mark <[EMAIL PROTECTED]> wrote: > > Of course I am not deleting the sources. In fact, I am also talking > about python scripts being called from shell scripts. There's a nice recipe in Python Cookbook (Martelli et al.) for this. It involves zipping your .pyc files and adding a

Re: Breaking up Strings correctly:

2007-04-09 Thread Gerard Flanagan
On Apr 9, 1:19 pm, "Michael Yanowitz" <[EMAIL PROTECTED]> wrote: > Hello: > >I have been searching for an easy solution, and hopefully one > has already been written, so I don't want to reinvent the wheel: > >Suppose I have a string of expressions such as: > "((($IP = "127.1.2.3") AND ($AX

Re: Making a small change to a large XML document

2007-09-24 Thread Gerard Flanagan
On Sep 25, 12:38 am, Dan Stromberg <[EMAIL PROTECTED]> wrote: > Say I want to take an existing XML document, and change the value="9997" > and value="9998" to two different numbers, without changing any of the > rest of the document - not even changing comments or indentation, if > avoidable. > > W

Re: Can you determine the sign of the polar form of a complex number?

2007-10-17 Thread Gerard Flanagan
On Oct 17, 3:17 pm, [EMAIL PROTECTED] wrote: > To compute the absolute value of a negative base raised to a > fractional exponent such as: > > z = (-3)^4.5 > > you can compute the real and imaginary parts and then convert to the > polar form to get the correct value: > > real_part = ( 3^-4.5 ) * co

Re: Best way to generate alternate toggling values in a loop?

2007-10-18 Thread Gerard Flanagan
On Oct 18, 1:55 am, Debajit Adhikary <[EMAIL PROTECTED]> wrote: > I'm writing this little Python program which will pull values from a > database and generate some XHTML. > > I'm generating a where I would like the alternate 's to be > > > and > > > What is the best way to do this? > from iter

Re: Python and Combinatorics

2007-10-26 Thread Gerard Flanagan
On Oct 25, 12:20 am, none <""atavory\"@(none)"> wrote: > Hello, > > Is there some package to calculate combinatorical stuff like (n over > k), i.e., n!/(k!(n - k!) ? > > I know it can be written in about 3 lines of code, but still... > > Thanks, > > Ami http

Python on AIX required files

2007-01-23 Thread Gerard Flanagan
Hello Problem: I want to send a Python script to someone running AIX Unix but who can't (or won't) compile or otherwise install the Python interpreter. If I have compiled Python on the same version of AIX, what would I need to provide to the user to enable him to run the script? Thanks Gerard

Re: Calling J from Python

2007-02-06 Thread Gerard Flanagan
On Feb 5, 3:48 pm, "Gosi" <[EMAIL PROTECTED]> wrote: > It is quite easy to call J from Python > > http://groups.google.com/group/J-Programming/browse_thread/thread/5e8... As I understand it, the k language, which is similar to J, is used to interact with streamed realtime financial data, where I i

Re: how to compare...

2007-02-13 Thread Gerard Flanagan
On Feb 13, 5:03 am, "jairodsl" <[EMAIL PROTECTED]> wrote: > Hello everybody ! > > I have two list, they are, S1=['A','B','C','D','E'], and > S2=['F','G','H','I','J'], but i have to compare both in this way: > > A vs J > A vs I, B vs J > A vs H,

Re: searching a list of lists as a two-dimensional array?

2007-02-14 Thread Gerard Flanagan
On Feb 12, 1:27 am, "agent-s" <[EMAIL PROTECTED]> wrote: > Basically I'm programming a board game and I have to use a list of > lists to represent the board (a list of 8 lists with 8 elements each). > I have to search the adjacent cells for existing pieces and I was > wondering how I would go about

basic jython question

2007-02-15 Thread Gerard Flanagan
Hello all I have a 'logger' module which is essentially just a facade over the 'logging' standard module. Can this be called from jython, and how is this acheived? This is a colleague's question but I have no knowledge of jython or java, and I can't install them at present in order to figure it ou

Re: basic jython question

2007-02-15 Thread Gerard Flanagan
On Feb 15, 1:53 pm, "Richard Brodie" <[EMAIL PROTECTED]> wrote: > "Gerard Flanagan" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > I have a 'logger' module which is essentially just a facade over the > > &#x

Re: scanning for numerals / letters

2006-04-19 Thread Gerard Flanagan
Kun wrote: > I have the following if statement that checks if a form is empty: > > if form.has_key("date") and form["date"].value != "": > date=form['date'].value > > else: > print "ERROR: No date entered!" > raise Exception > > I would also like to add another

Re: Strategy Design Pattern

2006-04-21 Thread Gerard Flanagan
Daniel Santa Cruz wrote: > Hello all, > > I've been trying to go over my OO Patterns book, and I decided to try > to implement them in Python this time around. I figured this would > help me learn the language better. > > Well, I've gotten stuck with my first go at OO patterns with Python. I > g

Re: proposed Python logo

2006-04-21 Thread Gerard Flanagan
Michael Yanowitz wrote: > How about having something from Monty Python in the logo rather > than something snakelike. Python was named after Monty Python and not > the snake. Snakes also don't appear friendly to me. > I used to have rats as pets. Snakes are murderers of rats. Which I Never mind

Re: how to append to a list twice?

2006-04-21 Thread Gerard Flanagan
John Salerno wrote: > If I want to create a list of the form [100, 99, 99, 98, 98, 97, 97...] > (where each item is repeated twice after the first one), how might I do > that most efficiently? > > Right now I have this: > > series = [100] > for x in range(10): # just for testing > series.ap

Re: how to append to a list twice?

2006-04-21 Thread Gerard Flanagan
Gerard Flanagan wrote: > John Salerno wrote: > > If I want to create a list of the form [100, 99, 99, 98, 98, 97, 97...] > > (where each item is repeated twice after the first one), how might I do > > that most efficiently? > > series = [100] > > for i in range(

Re: how to append to a list twice?

2006-04-21 Thread Gerard Flanagan
Gerard Flanagan wrote: > Gerard Flanagan wrote: > > John Salerno wrote: > > > If I want to create a list of the form [100, 99, 99, 98, 98, 97, 97...] > > > (where each item is repeated twice after the first one), how might I do > > > that most efficiently? >

Re: how to append to a list twice?

2006-04-21 Thread Gerard Flanagan
John Salerno wrote: > If I want to create a list of the form [100, 99, 99, 98, 98, 97, 97...] > (where each item is repeated twice after the first one), how might I do > that most efficiently? > > Right now I have this: > > series = [100] > for x in range(10): # just for testing > series.app

Re: Generate a sequence of random numbers that sum up to 1?

2006-04-22 Thread Gerard Flanagan
Anthony Liu wrote: > I am at my wit's end. > > I want to generate a certain number of random numbers. > This is easy, I can repeatedly do uniform(0, 1) for > example. > > But, I want the random numbers just generated sum up > to 1 . > > I am not sure how to do this. Any idea? Thanks. > ---

Re: Generate a sequence of random numbers that sum up to 1?

2006-04-22 Thread Gerard Flanagan
Gerard Flanagan wrote: > Anthony Liu wrote: > > I am at my wit's end. > > > > I want to generate a certain number of random numbers. > > This is easy, I can repeatedly do uniform(0, 1) for > > example. > > > > But, I want the random numbers just

<    1   2   3   4   >