Re: Running daemon with zdaemon ... example help?

2007-08-29 Thread helloizomi
Thank you, I got it now ^.^ On Aug 25, 3:10 pm, asrenzo <[EMAIL PROTECTED]> wrote: > Hi, > > This could also be a good starting > point:http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/278731 > > Regards, > > Laurent > > Genie T a écrit : > > > Hi all, > > > I'm looking atzdaemonto run my p

encoding problems

2007-08-29 Thread tool69
Hi, I would like to transform reST contents to HTML, but got problems with accented chars. Here's a rather simplified version using SVN Docutils 0.5: %- #!/usr/bin/env python # -*- coding: utf-8 -*- from docutils.core import publish_p

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 >

Re: Is it reasonably easy easy to something like this with python?

2007-08-29 Thread Bruno Desthuilliers
walterbyrd a écrit : > On Aug 28, 1:31 pm, Gerardo Herzig <[EMAIL PROTECTED]> wrote: >> walterbyrd wrote: > >> The one who make that table sorteable is AJAX. Not php. The php part is >> kind of trivial (so it would be `trivial' in python too). It just reads >> some data and format it in an html ta

Re: tempfile.mkstemp and os.fdopen

2007-08-29 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Michael J. Fromberger wrote: > ... since os.fdopen() only has access to the file descriptor, it > does not have a convenient way to obtain the file's name. You can do this under Linux as follows: os.readlink("/proc/%d/fd/%d" % (os.getpid(), fileno)) -- http:

Re: Check for dict key existence, and modify it in one step.

2007-08-29 Thread Bruno Desthuilliers
rodrigo a écrit : > You're right of course, I was unclear. I wasn't using 'dict' to > override the dict clas, but just as a standin for the example (the > actual dictionary names are varied). I guessed so, but Python's behaviour wrt/ naming can be somewhat surprising for newcomers, and accidental

Re: status of Programming by Contract (PEP 316)?

2007-08-29 Thread Michele Simionato
On Aug 29, 8:45 am, Russ <[EMAIL PROTECTED]> wrote: > I get the strong impression you don't really understand what > programming by contract is. > > I have not yet personally used it, but I am interested in anything > that can help to make my programs more reliable. If you are > programming somethi

Pythonwin Install COM exceptions on Windows Vista Ultimate

2007-08-29 Thread Sandipan News
What do I do? Can't do without Python! Any experience, advice, hope is welcome. Thanks. Sandipan -- http://mail.python.org/mailman/listinfo/python-list

Re: encoding problems

2007-08-29 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, tool69 wrote: > p2.content = """Ce poste possède des accents : é à ê è""" My guess is this is being encoded as a Latin-1 string, but when you try to output it it goes through the ASCII encoder, which doesn't understand the accents. Try this: p2.content = u"""Ce po

Re: Jython 2.2 on Ubuntu

2007-08-29 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Neil Wallace wrote: > I have used the > GUI installer of Jython 2.2, and installed it to the default > /root/jython2.2 directory. You do realize that /root is the home directory of the root user, normally off-limits to normal users? Usually if you're installing yo

Re: encoding problems

2007-08-29 Thread Diez B. Roggisch
tool69 wrote: > Hi, > > I would like to transform reST contents to HTML, but got problems > with accented chars. > > Here's a rather simplified version using SVN Docutils 0.5: > > %- > > #!/usr/bin/env python > # -*- coding: utf-8 -*-

Re: encoding problems

2007-08-29 Thread tool69
Lawrence D'Oliveiro a écrit : > In message <[EMAIL PROTECTED]>, tool69 wrote: > >> p2.content = """Ce poste possède des accents : é à ê è""" > > My guess is this is being encoded as a Latin-1 string, but when you try to > output it it goes through the ASCII encoder, which doesn't understand the >

Re: Gmane's been quiet ...

2007-08-29 Thread Lawrence Oluyede
Grant Edwards <[EMAIL PROTECTED]> wrote: > Posting that were made to mailing lists via gmane? That, I do not know -- Lawrence, oluyede.org - neropercaso.it "It is difficult to get a man to understand something when his salary depends on not understanding it" - Upton Sinclair -- http://mail.pyt

Re: encoding problems

2007-08-29 Thread tool69
Diez B. Roggisch a écrit : > tool69 wrote: > >> Hi, >> >> I would like to transform reST contents to HTML, but got problems >> with accented chars. >> >> Here's a rather simplified version using SVN Docutils 0.5: >> >> %- >> >> #!/usr/bin

Error handling in file generation (Pythonic way: with / decorators?)

2007-08-29 Thread xavim
Hi everyone, I am writing a small tool that generates a file from a list of sources. The function dictgen(dictfile, *sources) takes a list of sources path and an open file object and does the processing. I am having some problems with how to do proper error handling. One of the requirements is th

Re: Error handling in file generation (Pythonic way: with / decorators?)

2007-08-29 Thread xavim
On Aug 29, 10:58 am, xavim <[EMAIL PROTECTED]> wrote: > (...) > try: > (...) > except: > os.remove(dictpath) This should read:: try: (...) except: os.remove(dictpath) raise Sorry. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to parse this line of code manually

2007-08-29 Thread Davy
On Aug 28, 7:28 pm, Dustan <[EMAIL PROTECTED]> wrote: > On Aug 28, 2:59 am, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: > > > > > > > On 2007-08-28, Davy <[EMAIL PROTECTED]> wrote: > > > > On Aug 28, 11:00 am, Davy <[EMAIL PROTECTED]> wrote: > > >> Hi all, > > > >> It is well known that Python is appr

Re: Error handling in file generation (Pythonic way: with / decorators?)

2007-08-29 Thread Marc 'BlackJack' Rintsch
On Wed, 29 Aug 2007 08:58:52 +, xavim wrote: > I am having some problems with how to do proper error handling. > One of the requirements is that the destination file should not be > created if there is any error in the processing. > > I have come out with the following code:: > > dictfil

Re: Haskell like (c:cs) syntax

2007-08-29 Thread Marco Mariani
Ricardo Aráoz ha scritto: > L = ['one', 'two', 'three', 'four', 'five'] > > print L[0]# This would be 'head' > print L[1:] # This would be 'tail' > > Caution : L[0] and L[1:] are COPIES of the head and tail of the list. This might surprise people who see L[1:] = [], since changing a copy

Re: advice about `correct' use of decorator

2007-08-29 Thread BJörn Lindqvist
On 8/24/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Thu, 23 Aug 2007 09:20:21 -0300, BJörn Lindqvist <[EMAIL PROTECTED]> > escribi�: > > > def check_user_logged_in(func): > > def f(*args, **kwargs): > > if global_state.the_user.is_logged_in: > > return func(*args,

Re: tempfile.mkstemp and os.fdopen

2007-08-29 Thread Nick Craig-Wood
Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: > In message <[EMAIL PROTECTED]>, Michael > J. Fromberger wrote: > > > ... since os.fdopen() only has access to the file descriptor, it > > does not have a convenient way to obtain the file's name. > > You can do this under Linux as follows: > >

Re: Haskell like (c:cs) syntax

2007-08-29 Thread Nick Craig-Wood
Erik Jones <[EMAIL PROTECTED]> wrote: > front, last = l[:len(l) - 1], l[len(l) - 1] Normally written as front, last = l[:-1], l[-1] -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Gmane's been quiet ...

2007-08-29 Thread Steve Holden
Lawrence Oluyede wrote: > Grant Edwards <[EMAIL PROTECTED]> wrote: >> Posting that were made to mailing lists via gmane? > > That, I do not know > Given that I have now read a reply to my post-via-gmane on gmane before seeing the original post appear there I shall assume they've been having som

Re: Creating a multi-tier client/server application

2007-08-29 Thread Bruno Desthuilliers
Paul Rubin a écrit : > Jeff <[EMAIL PROTECTED]> writes: >> Here's a broad overview of what I need to do: cross-platform, client- >> side GUI apps that interact with a server backed by a database. I'd >> also like the possibility of having a web interface for small portions >> of the app. ... an

Re: tempfile.mkstemp and os.fdopen

2007-08-29 Thread billiejoex
Gabriel Genellina wrote: > As someone already suggested, why don't you use TemporaryFile or > NamedTemporaryFile and avoid such problems? Because I don't want file to be removed after closing. -- http://mail.python.org/mailman/listinfo/python-list

Re: Unable to read large files from zip

2007-08-29 Thread Nick Craig-Wood
Kevin Ar18 <[EMAIL PROTECTED]> wrote: > > I posted this on the forum, but nobody seems to know the solution: > http://python-forum.org/py/viewtopic.php?t=5230 > > I have a zip file that is several GB in size, and one of the files inside of > it is several GB in size. When it comes time to re

Re: encoding problems

2007-08-29 Thread Ricardo Aráoz
Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, tool69 wrote: > >> p2.content = """Ce poste possède des accents : é à ê è""" > > My guess is this is being encoded as a Latin-1 string, but when you try to > output it it goes through the ASCII encoder, which doesn't understand the > ac

self extracting zipefile (windows) and (standard module) zipefile

2007-08-29 Thread Werner
Hi, I try to read (and extract) some "self extracting" zipefiles on a Windows system. The standard module zipefile seems not to be able to handle this. >>> fName = r"C:\tmp\mySelfExtratingFile.exe" >>> import zipfile >>> zipefile.is_zipfile(fName)) False Is there a wrapper or has some one exper

Code design problem

2007-08-29 Thread Marco Nawijn
Hello, I have a hard time figuring out an elegant and efficient design for the following problem. I am working on automation of structural design problems. In the majority of cases, this boils down to executing programs in batch in one or more loops. The scripts to control the execution differ fr

Re: Haskell like (c:cs) syntax

2007-08-29 Thread Ricardo Aráoz
Marco Mariani wrote: > Ricardo Aráoz ha scritto: > >> L = ['one', 'two', 'three', 'four', 'five'] >> >> print L[0]# This would be 'head' >> print L[1:] # This would be 'tail' >> >> Caution : L[0] and L[1:] are COPIES of the head and tail of the list. > > This might surprise people who see L

Re: encoding problems

2007-08-29 Thread Diez B. Roggisch
Ricardo Aráoz wrote: > Lawrence D'Oliveiro wrote: >> In message <[EMAIL PROTECTED]>, tool69 wrote: >> >>> p2.content = """Ce poste possède des accents : é à ê è""" >> >> My guess is this is being encoded as a Latin-1 string, but when you try >> to output it it goes through the ASCII encoder, whi

handling tabular data in python--newbie question

2007-08-29 Thread hyena
Hi, Just jump in python few days. I am wondering how to store and index a table in python effectively and easily.I think the basic data types are not very straight foward to handle a table (eg, from csv or data base.) I have a csv file, the first row of it is column names and the rest rows

Re: Unable to read large files from zip

2007-08-29 Thread David Bolen
Nick Craig-Wood <[EMAIL PROTECTED]> writes: > Kevin Ar18 <[EMAIL PROTECTED]> wrote: >> >> I posted this on the forum, but nobody seems to know the solution: >> http://python-forum.org/py/viewtopic.php?t=5230 >> >> I have a zip file that is several GB in size, and one of the files inside >> o

Re: Code design problem

2007-08-29 Thread Marshall T. Vandegrift
Marco Nawijn <[EMAIL PROTECTED]> writes: > The problem I face is that the implementation of the application class > is completely different for the local and remote case. The local case > is a straightforward implemenation using the subprocess module, the > remote case is a CORBA implementation. S

Re: handling tabular data in python--newbie question

2007-08-29 Thread Bruno Desthuilliers
hyena a écrit : > Hi, > Just jump in python few days. I am wondering how to store and index a > table in python effectively and easily.I think the basic data types are not > very straight foward to handle a table (eg, from csv or data base.) What make you think such a thing ? > I have a csv

Re: Code design problem

2007-08-29 Thread Sion Arrowsmith
Marco Nawijn <[EMAIL PROTECTED]> wrote: >I have a hard time figuring out an elegant and efficient design for >the following problem. What you want is known as the factory pattern. > [ ... ] I would >like the following (pseudo)-code to work: > >app = Application('patran') # Run o

Re: Haskell like (c:cs) syntax

2007-08-29 Thread Istvan Albert
On Aug 29, 8:12 am, Ricardo Aráoz <[EMAIL PROTECTED]> wrote: > >> Caution : L[0] and L[1:] are COPIES of the head and tail of the list. > Sorry, should have written RETURN copies instead of ARE copies. L[0] does not return a copy, it does what is says, returns the object stored at index 0. i.

Re: Code design problem

2007-08-29 Thread Bruno Desthuilliers
Marco Nawijn a écrit : > Hello, > > I have a hard time figuring out an elegant and efficient design for > the following problem. > > I am working on automation of structural design problems. In the > majority of cases, this boils down to executing programs in batch in > one or more loops. The scr

Re: self extracting zipefile (windows) and (standard module) zipefile

2007-08-29 Thread Hyuga
First of all, there's really no such thing as a "self extracting zipefile". I mean, obviously you have to do something to unzip it. A file doesn't just execute itself. What you're dealing with is not a _zip file_. It's an executable that has a zip file bundled with it, and the code to unzip it,

Re: Pythonwin Install COM exceptions on Windows Vista Ultimate

2007-08-29 Thread kyosohma
On Aug 28, 8:20 pm, "Sandipan News" <[EMAIL PROTECTED]> wrote: > What do I do? Can't do without Python! > Any experience, advice, hope is welcome. > Thanks. > Sandipan You need to post the error traceback along with some more information so the community can help. Mike -- http://mail.python.org

Re: Creating a multi-tier client/server application

2007-08-29 Thread Jeff
Thanks for the quick responses. I was really hoping to avoid an entirely web-based app, for a few reasons, not the least of which is that I've been working almost entirely on web apps for the past few years, and I am getting mighty sick of it. A lot of that is due to the language (PHP, which I ha

Re: Haskell like (c:cs) syntax

2007-08-29 Thread Steve Holden
Istvan Albert wrote: > On Aug 29, 8:12 am, Ricardo Aráoz <[EMAIL PROTECTED]> wrote: > Caution : L[0] and L[1:] are COPIES of the head and tail of the list. > >> Sorry, should have written RETURN copies instead of ARE copies. > > L[0] does not return a copy, it does what is says, returns the

Python molecular viewer

2007-08-29 Thread Andy Cheesman
Dear People, I was wondering if people could recommend a simple molecular viewing package written in python. I'm working in Theoretical chemistry and I'm not after an all-singing dancing molecular rendering package(pymol does that rather well) but a program which reads XYZ files and displays simpl

What's the difference ?

2007-08-29 Thread Alex
Hye, I was just wondering what is the difference between >> if my_key in mydict: >> ... and >> if mydict.has_keys(my_key): >> ... I've search a bit in the python documentation, and the only things I found was that they are "equivalent". But in this (quiet old) sample ( "http://aspn.ac

Re: Creating a multi-tier client/server application

2007-08-29 Thread Bruno Desthuilliers
Jeff a écrit : > Thanks for the quick responses. > > I was really hoping to avoid an entirely web-based app, for a few > reasons, not the least of which is that I've been working almost > entirely on web apps for the past few years, and I am getting mighty > sick of it. A lot of that is due to th

Re: How to free memory ( ie garbage collect) at run time with Python 2.5.1(windows)

2007-08-29 Thread M�ta-MCI \(MVP\)
Hi! I've send the soft. But, I have no news ; good news? @+ Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: Pythonwin Install COM exceptions on Windows Vista Ultimate

2007-08-29 Thread Larry Bates
Sandipan News wrote: > What do I do? Can't do without Python! > Any experience, advice, hope is welcome. > Thanks. > Sandipan > > If you are asking if you can run COM objects created in Python on Windows Vista Ultimate, the answer is yes. I have several. -Larry -- http://mail.python.org/mailm

Re: Getting subprocesses to be hidden on Windows

2007-08-29 Thread kyosohma
On Aug 28, 1:13 pm, geoffbache <[EMAIL PROTECTED]> wrote: > On 28 Aug, 18:18, Larry Bates <[EMAIL PROTECTED]> wrote: > > > > > geoffbache wrote: > > > Hi, > > > > As part of my efforts to write a test tool that copes with GUIs > > > nicely, I'm trying to establish how I can start a GUI process on >

Re: Code design problem

2007-08-29 Thread Marco Nawijn
On Aug 29, 3:03 pm, "Marshall T. Vandegrift" <[EMAIL PROTECTED]> wrote: > Marco Nawijn <[EMAIL PROTECTED]> writes: > > The problem I face is that the implementation of the application class > > is completely different for the local and remote case. The local case > > is a straightforward implemenat

Re: Gmane's been quiet ...

2007-08-29 Thread Grant Edwards
On 2007-08-29, Steve Holden <[EMAIL PROTECTED]> wrote: > Lawrence Oluyede wrote: >> Grant Edwards <[EMAIL PROTECTED]> wrote: >>> Posting that were made to mailing lists via gmane? >> >> That, I do not know >> > Given that I have now read a reply to my post-via-gmane on gmane before > seeing the

Re: handling tabular data in python--newbie question

2007-08-29 Thread Steve Holden
hyena wrote: > Hi, > Just jump in python few days. I am wondering how to store and index a > table in python effectively and easily.I think the basic data types are not > very straight foward to handle a table (eg, from csv or data base.) > > I have a csv file, the first row of it is column

Re: self extracting zipefile (windows) and (standard module) zipefile

2007-08-29 Thread kyosohma
On Aug 29, 6:53 am, Werner <[EMAIL PROTECTED]> wrote: > Hi, > > I try to read (and extract) some "self extracting" zipefiles on a > Windows system. The standard module zipefile seems not to be able to > handle this. > > >>> fName = r"C:\tmp\mySelfExtratingFile.exe" > >>> import zipfile > >>> zipefi

Re: What's the difference ?

2007-08-29 Thread kyosohma
On Aug 29, 8:39 am, Alex <[EMAIL PROTECTED]> wrote: > Hye, > > I was just wondering what is the difference between > > >> if my_key in mydict: > >> ... > > and > > >> if mydict.has_keys(my_key): > >> ... > > I've search a bit in the python documentation, and the only things I > found was th

Re: What's the difference ?

2007-08-29 Thread Marc 'BlackJack' Rintsch
On Wed, 29 Aug 2007 13:39:27 +, Alex wrote: > Hye, > > I was just wondering what is the difference between > >>> if my_key in mydict: >>> ... > > and > >>> if mydict.has_keys(my_key): >>> ... > > I've search a bit in the python documentation, and the only things I > found was that

strange list comprehension on generator

2007-08-29 Thread Roland Puntaier
def changeOne(aa,idx): aa[idx]=not aa[idx] yield aa for i in range(idx): for x in changeOne(aa,i): yield x def changeOneOrder(aa): yield aa for i in range(len(aa)): for x in changeOne(aa,i): yield x a=[False]*3 og=changeOneOrder(a) #this does not return the way I wo

Re: status of Programming by Contract (PEP 316)?

2007-08-29 Thread Aahz
In article <[EMAIL PROTECTED]>, Russ <[EMAIL PROTECTED]> wrote: > >I just stumbled onto PEP 316: Programming by Contract for Python >(http://www.python.org/dev/peps/pep-0316/). This would be a great >addition to Python, but I see that it was submitted way back in 2003, >and its status is "deferred

Re: non-blocking communication with imaplib

2007-08-29 Thread Igor V. Rafienko
[ Lawrence D'Oliveiro ] [ ... ] > According to the documentation > , you can override > the "read" and "readline" methods. How about replacing them with > routines that use select.select on the socket() object to implement > a timeout? Sounds like

Re: self extracting zipefile (windows) and (standard module) zipefile

2007-08-29 Thread Grant Edwards
On 2007-08-29, Hyuga <[EMAIL PROTECTED]> wrote: >> I try to read (and extract) some "self extracting" zipefiles >> on a Windows system. The standard module zipefile seems not to >> be able to handle this. [...] > > First of all, there's really no such thing as a "self > extracting zipefile". Perh

Re: Creating a multi-tier client/server application

2007-08-29 Thread Jeff
> You could explore something like a custom-made GUI client app > communicating thru the http protocol with a web-server app. http is just > a protocol, and it doesn't necessarily imply using html and a browser... > IIRC, some GUI toolkits uses XML description files for the UI. That, or something

Re: Creating a multi-tier client/server application

2007-08-29 Thread Goldfish
Perhaps Spring Python can help you out (http://springpython.python- hosting.com). It reuses technologies like Pyro for remoting, offers database templates, has a plugable security component, an AOP solution should the need arise, an IoC container, and has a couple of web-app demos using CherryPy. O

Re: strange list comprehension on generator

2007-08-29 Thread Bjoern Schliessmann
No greeting, no text? Pity. Roland Puntaier wrote: > def changeOne(aa,idx): > aa[idx]=not aa[idx] > yield aa > for i in range(idx): > for x in changeOne(aa,i): > yield x > > def changeOneOrder(aa): > yield aa > for i in range(len(aa)): > for x in changeOne(aa,i): >

Re: strange list comprehension on generator

2007-08-29 Thread Martin v. Löwis
> #this does not return the way I would expect. why? You yield the very same list object all the times. So when you make a later change, all earlier results will get changed, too (since they are the same object). Of course, it won't affect the terminal output, so you don't see that the older value

Re: What's the difference ?

2007-08-29 Thread Alex Martelli
Alex <[EMAIL PROTECTED]> wrote: > Hye, > > I was just wondering what is the difference between > > >> if my_key in mydict: > >> ... > > and > > >> if mydict.has_keys(my_key): Mis-spelled (no final s in the method name). > >> ... > > I've search a bit in the python documentation, and

Re: What's the difference ?

2007-08-29 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: ... > Weird. Hetland's book, "Beginning Python" states that it's a matter of > taste. If your taste is for more verbose AND slower notation without any compensating advantage, sure. > Martelli's "Python Cookbook 2nd Ed." says to use the get() > method instead as you

Re: Jython 2.2 on Ubuntu

2007-08-29 Thread Neil Wallace
Thanks Tim, I subscribed to the Jython group hosted by sourceforge, and they are a great bunch of guys/gals. Here's what I did to fix my problem. 1. removed Jython 2.1 (using Synaptic)jytho 2. added the following lines (as root) to /etc/profile # set PATH for Jython PATH=$

Re: handling tabular data in python--newbie question

2007-08-29 Thread hyena
Thanks Bruno and Steve for the quick answer! >What make you think such a thing ? I am also using R and java from time to time, and think it is very covinient that in R tables are handled as matrixs or data frames. Thus I expect python has something similiar. :) And I went for Steve's first sugg

replacing xml elements with other elements using lxml

2007-08-29 Thread Ultrus
Hello, I'm attempting to generate a random story using xml as the document, and lxml as the parser. I want the document to be simplified before processing it further, and am very close to accomplishing my goal. Below is what I have so far. Any ideas on how to move forward? The goal: read and edit

Re: strange list comprehension on generator

2007-08-29 Thread [EMAIL PROTECTED]
On Aug 29, 6:50 am, Roland Puntaier <[EMAIL PROTECTED] automation.com> wrote: > def changeOne(aa,idx): > aa[idx]=not aa[idx] > yield aa > for i in range(idx): > for x in changeOne(aa,i): > yield x > > def changeOneOrder(aa): > yield aa > for i in range(len(aa)): > for x in c

Re: What's the difference ?

2007-08-29 Thread kyosohma
On Aug 29, 9:44 am, [EMAIL PROTECTED] (Alex Martelli) wrote: > <[EMAIL PROTECTED]> wrote: > >... > > > Weird. Hetland's book, "Beginning Python" states that it's a matter of > > taste. > > If your taste is for more verbose AND slower notation without any > compensating advantage, sure. > > > Ma

Re: encoding problems

2007-08-29 Thread Damjan
> > is there a way to sort this string properly (sorted()?) > I mean first 'a' then 'à' then 'e' etc. (sorted puts accented letters at > the end). Or should I have to provide a comparison function to sorted? After setting the locale... locale.strcoll() -- damjan -- http://mail.python.org/mai

general function for sorting a matrix

2007-08-29 Thread Xah Lee
A couple years ago, i posted a programing problem, about writing a function that will sort a arbitrarily dimentioned matrix in any possible way to sort it. Such a function, is rather typical in functional programing languages. I wrote a version in 1999 in perl for practical purposes, since sortin

Re: What's the difference ?

2007-08-29 Thread Alexandre Badez
Thanks for all you information. I'll continue to use 'in' instead of 'has_key' for a "faster, more concise, & readable" code (^L^ ) -- http://mail.python.org/mailman/listinfo/python-list

python + gcov

2007-08-29 Thread labrach
Hi I want to profile (and analyse coverage) some c++ code imported as a python module I've compiled python (2.4.2) with gcc 3.4.3 and flags=-Wall -fprofile- arcs -ftest-coverage in order to use gcov. However, the python binary does not generate any coverage file (such than *.gcno, gcda) during exe

Re: Creating a multi-tier client/server application

2007-08-29 Thread Bruno Desthuilliers
Jeff a écrit : >> You could explore something like a custom-made GUI client app >> communicating thru the http protocol with a web-server app. http is just >> a protocol, and it doesn't necessarily imply using html and a browser... >> IIRC, some GUI toolkits uses XML description files for the UI. >

Re: general function for sorting a matrix

2007-08-29 Thread Marc 'BlackJack' Rintsch
On Wed, 29 Aug 2007 08:47:27 -0700, Xah Lee wrote: > While reviewing this code, there's something interesting of note. > > Namely, in my perl solution, the approach is drastically different > than the python version. Instead of sorting by looping thru the > sorting directives, it parses the direc

Re: replacing xml elements with other elements using lxml

2007-08-29 Thread Stefan Behnel
Ultrus wrote: > I'm attempting to generate a random story using xml as the document, > and lxml as the parser. I want the document to be simplified before > processing it further, and am very close to accomplishing my goal. > Below is what I have so far. Any ideas on how to move forward? > > The g

Re: Gmane's been quiet ...

2007-08-29 Thread Robert Marshall
On Wed, 29 Aug 2007, Steve Holden wrote: > > Lawrence Oluyede wrote: >> Grant Edwards <[EMAIL PROTECTED]> wrote: >>> Posting that were made to mailing lists via gmane? >> >> That, I do not know >> > Given that I have now read a reply to my post-via-gmane on gmane > before seeing the original post

Re: general function for sorting a matrix

2007-08-29 Thread Stefan Behnel
Xah Lee wrote: [undermotivated blah stripped] don't feed the troll. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Gmane's been quiet ...

2007-08-29 Thread Grant Edwards
On 2007-08-29, Robert Marshall <[EMAIL PROTECTED]> wrote: >> Given that I have now read a reply to my post-via-gmane on gmane >> before seeing the original post appear there I shall assume they've >> been having some sort of issue. > > See http://news.gmane.org/gmane.discuss for some discussion of

Re: status of Programming by Contract (PEP 316)?

2007-08-29 Thread Chris Mellon
On 8/29/07, Russ <[EMAIL PROTECTED]> wrote: > On Aug 28, 10:58 pm, Michele Simionato <[EMAIL PROTECTED]> > wrote: > > > Why do you think that would ad a strong positive capability? > > To me at least it seems a big fat lot of over-engineering, not > > needed in 99% of programs. In the remaining 1%,

cgi

2007-08-29 Thread Gigs_
i have simple page and form that ask for name and color and cgi script that print that name in another page and background in chosen color all the time this error pop: Error response Error code 501. Message: Can only POST to CGI scripts. Error code explanation: 501 = Server does not support th

Re: Creating a multi-tier client/server application

2007-08-29 Thread Jeff
Goldfish--thanks, I'll check it out. > > That, or something similar, may be what I do. It would mean, however, > > developing my own method for transferring objects across the network, > > Why transfering "objects" ? You only need to transfer data. I suppose I don't need to transfer objects, it

Re: general function for sorting a matrix

2007-08-29 Thread Neil Cerutti
On 2007-08-29, Xah Lee <[EMAIL PROTECTED]> wrote: > A couple years ago, i posted a programing problem, about > writing a function that will sort a arbitrarily dimentioned > matrix in any possible way to sort it. > > Such a function, is rather typical in functional programing > languages. I wrote a

Accessing docstrings at runtime?

2007-08-29 Thread Kenneth Love
How do I print the docstring for a class property? When I run the code below, I get the docstring for the string module and not the one I set for the property. - # NOTE: Found in Python docs defining built-in functions (such as # property()). FIX

Re: Accessing docstrings at runtime?

2007-08-29 Thread Chris Mellon
On 8/29/07, Kenneth Love <[EMAIL PROTECTED]> wrote: > How do I print the docstring for a class property? > > When I run the code below, I get the docstring for the string module > and not the one I set for the property. > > - > # NOTE: Found in Python doc

copying files

2007-08-29 Thread Brian McCann
Hi, with the code below I set a variable TEST_HOME to a path and the variable m to a path in my current dir. I have a symbolic link setting m>lib when I run the script I get no errors and the lib dir with its 20 files does not get copied to /v01/test_home any help would be greatly apprecia

RE: copying files

2007-08-29 Thread Brian McCann
one thing I just noticed is that when I run the script I get a new symbolic link created in my current dir TEST_HOME-->lib --Brian From: [EMAIL PROTECTED] on behalf of Brian McCann Sent: Wed 8/29/2007 2:40 PM To: python-list@py

Re: Creating a multi-tier client/server application

2007-08-29 Thread Bruno Desthuilliers
Jeff a écrit : > Goldfish--thanks, I'll check it out. > > >>>That, or something similar, may be what I do. It would mean, however, >>>developing my own method for transferring objects across the network, >> >>Why transfering "objects" ? You only need to transfer data. > > I suppose I don't nee

Re: Accessing docstrings at runtime?

2007-08-29 Thread Bruno Desthuilliers
Chris Mellon a écrit : > On 8/29/07, Kenneth Love <[EMAIL PROTECTED]> wrote: > >>How do I print the docstring for a class property? (snip) > You're looking at an instance, not at the class. y.x is going through > the descriptor lookup and is returning the string, so the __doc__ is > the the __doc_

Re: copying files

2007-08-29 Thread Ricardo Aráoz
Brian McCann wrote: > Hi, > > with the code below I set a variable TEST_HOME to a path and the > variable m to a path > in my current dir. > I have a symbolic link setting m>lib > when I run the script I get no errors and the lib dir with its 20 files > does not get copied to /v01/test_home >

Re: copying files

2007-08-29 Thread Ricardo Aráoz
Brian McCann wrote: > Hi, > > with the code below I set a variable TEST_HOME to a path and the > variable m to a path > in my current dir. > I have a symbolic link setting m>lib > when I run the script I get no errors and the lib dir with its 20 files > does not get copied to /v01/test_home >

Re: cgi

2007-08-29 Thread Fabio Z Tessitore
Il Wed, 29 Aug 2007 19:24:54 +0200, Gigs_ ha scritto: > i have simple page and form that ask for name and color and cgi script > that print that name in another page and background in chosen color > > all the time this error pop: > Error response > > Error code 501. > > Message: Can only POST t

Re: copying files

2007-08-29 Thread kyosohma
On Aug 29, 1:51 pm, Ricardo Aráoz <[EMAIL PROTECTED]> wrote: > Brian McCann wrote: > > Hi, > > > with the code below I set a variable TEST_HOME to a path and the > > variable m to a path > > in my current dir. > > I have a symbolic link setting m>lib > > when I run the script I get no errors an

Unzip: Memory Error

2007-08-29 Thread mcl
I am trying to unzip an 18mb zip containing just a single 200mb file and I get a Memory Error. When I run the code on a smaller file 1mb zip, 11mb file, it works fine. I am running on a hosted Apache web server I am using some code I found on the web somewhere. def unzip_file_into_dir(file, di

Re: Creating a multi-tier client/server application

2007-08-29 Thread askel
On Aug 29, 1:31 pm, Jeff <[EMAIL PROTECTED]> wrote: > Goldfish--thanks, I'll check it out. > > > > That, or something similar, may be what I do. It would mean, however, > > > developing my own method for transferring objects across the network, > > > Why transfering "objects" ? You only need to tr

sys.argv is munging my command line options

2007-08-29 Thread Chris Allen
The command line syntax for my program is as follows: action key=value key=value... Where action is a required string (ie. 'backup', 'init', 'restore', etc) and the program can accept one or more key value pairs. I know this syntax isn't standard, but I think it works great for my program as eac

Re: cgi

2007-08-29 Thread Gigs_
Fabio Z Tessitore wrote: > Il Wed, 29 Aug 2007 19:24:54 +0200, Gigs_ ha scritto: > >> i have simple page and form that ask for name and color and cgi script >> that print that name in another page and background in chosen color >> >> all the time this error pop: >> Error response >> >> Error code

Re: sys.argv is munging my command line options

2007-08-29 Thread Ant
On Aug 29, 8:11 pm, Chris Allen <[EMAIL PROTECTED]> wrote: ... > But I'm running into a problem with this which is that sys.argv splits > my key=value options. I need to know the option associations, and > there's no way to know this by inspecting sys.argv. Can I get access > to the command line

Re: sys.argv is munging my command line options

2007-08-29 Thread Chris Allen
Thanks for the reply. Oops... I forget that I was calling the program from a shell script, the shell script was responsible for goofing up my command line options. Solved. Thanks again. On Aug 29, 12:28 pm, Ant <[EMAIL PROTECTED]> wrote: > On Aug 29, 8:11 pm, Chris Allen <[EMAIL PROTECTED]> wr

re compiled object result caching?

2007-08-29 Thread Dan
I find myself often using regular expressions in the following pattern: foo_re = re.compile(r"foo(bar)") # . . . re_result = foo_re.search(line) if re_result: bar = re_result.group(1) # . . . But, I keep thinking this is awkward, and I would kind of like to have the re object to cache it

  1   2   >