Re: Biased random?

2007-08-27 Thread Robert Kern
Jun-geun Park wrote: > Ivan Voras wrote: >> Hi, >> >> I have a list of items, and need to choose several elements from it, >> "almost random". The catch is that the elements from the beginning >> should have more chance of being selected than those at the end (how >> much more? I don't care how the

Re: "Try:" which only encompasses head of compound statement

2007-08-27 Thread Carl Banks
On Aug 27, 5:35 pm, [EMAIL PROTECTED] wrote: > I have: > > try: > for line in open(myFileName): > count += 1 > except IOError: > print "Can't open myfile" > > (I know, this is bad, I never close the file, but its just for > illustration). But then I change it to: > > try: > for

Re: Socket - gaierror

2007-08-27 Thread Douglas Wells
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] writes: > On Aug 27, 12:32 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > > Changing it to IP gives me the same exact error... > > File "bin/prgram.py", line 123, in notify > smtp = smtplib.SMTP("XXX.XXX.XXX.XXX") > > File "/usr/lib/python

Re: "Try:" which only encompasses head of compound statement

2007-08-27 Thread Ben Finney
[EMAIL PROTECTED] writes: > try: > for line in open(myFileName): > count += openAndProcessSubfile(line) > except IOError: > print "Can't open myfile" > > ... now the 'except' incorrectly catches errors from > openAndProcessSubfile. So don't include it. You've discovered a good pr

Re: convert non-delimited to delimited

2007-08-27 Thread Paul McGuire
On Aug 27, 12:59 pm, RyanL <[EMAIL PROTECTED]> wrote: > I'm a newbie! I have a non-delimited data file that I'd like to > convert to delimited. > > Example... > Line in non-delimited file: > 01397256359210100534+42050-102800FM-15+1198KAIA > > Should be: > 0139,725635,9,2000,01,01,00,53

Re: Socket - gaierror

2007-08-27 Thread half . italian
On Aug 27, 4:22 pm, [EMAIL PROTECTED] (Douglas Wells) wrote: > In article <[EMAIL PROTECTED]>, > > > > [EMAIL PROTECTED] writes: > > On Aug 27, 12:32 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > > > Changing it to IP gives me the same exact error... > > > File "bin/prgram.py", line 123, in notif

Re: Error with Simplemapi.py

2007-08-27 Thread Mick Duprez
On Aug 27, 4:46 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Mon, 27 Aug 2007 03:05:30 -0300, Mick Duprez <[EMAIL PROTECTED]> > escribi?: > > > Thank you very much Gabriel, changing the NULL to None did the trick > > (it also helps if I reload the changed module after editing!:( ). > > G

Re: some problems with mod_python

2007-08-27 Thread Bruno Desthuilliers
Johan a écrit : > Hi > > I have installed and tested this on centos, fedora and freebsd all > give the same problem so I guess I missed some steps. > > I have compiled bot apache (2.2.4) and mod_python (3.3.1) according to > the docs and no problem with this. > But when I have made everything abo

XML File -- dictionary edit/search

2007-08-27 Thread -b
I am trying to put together a python program that will be able to ask for a word and its definition, then save that information into an xml file for reference. I am not down right set on the file being in xml format, but xml is the first thing that comes to mind, since I do not want to use a MySQL

Re: some problems with mod_python

2007-08-27 Thread Bruno Desthuilliers
Bruno Desthuilliers a écrit : > Johan a écrit : > >> Hi >> >> I have installed and tested this on centos, fedora and freebsd all >> give the same problem so I guess I missed some steps. >> >> I have compiled bot apache (2.2.4) and mod_python (3.3.1) according to >> the docs and no problem with thi

Re: Socket - gaierror

2007-08-27 Thread Steve Holden
[EMAIL PROTECTED] wrote: > On Aug 27, 12:47 pm, [EMAIL PROTECTED] wrote: >> On Aug 27, 12:32 pm, Larry Bates <[EMAIL PROTECTED]> wrote: >> >> >> >>> [EMAIL PROTECTED] wrote: Hi all, I'm having trouble with the socket module resolving a hostname. It seems like this is a system level

Re: SCF released to GPL

2007-08-27 Thread hg
Méta-MCI (MVP) wrote: > Salut ! > > Le deuxième envoi aurait pu être en français. > Cela aurait évité le doublon, tout en maintenant le message. > > @+ > > Michel Claveau > ;-) No: 1) The redundancy is due to the fact that I just moved to another state/ISP and that ... for some reason, the i

Re: SCF released to GPL

2007-08-27 Thread hg
hg wrote: > Méta-MCI (MVP) wrote: >> Salut ! >> >> Le deuxième envoi aurait pu être en français. >> Cela aurait évité le doublon, tout en maintenant le message. >> >> @+ >> >> Michel Claveau >> > > ;-) > > No: > 1) The redundancy is due to the fact that I just moved to another > state/ISP and th

Re: How to parse this line of code manually

2007-08-27 Thread Davy
On Aug 28, 11:00 am, Davy <[EMAIL PROTECTED]> wrote: > Hi all, > > It is well known that Python is appreciated for its merit of concise. > However, I found the over concise code is too hard to understand for > me. > > Consider, for instance, > def known_edits2(word): > return set(e2 for e1 in e

How to parse this line of code manually

2007-08-27 Thread Davy
Hi all, It is well known that Python is appreciated for its merit of concise. However, I found the over concise code is too hard to understand for me. Consider, for instance, def known_edits2(word): return set(e2 for e1 in edits1(word) for e2 in edits1(e1) if e2 in NWORDS) Shall I understand

Asking all python programmers.

2007-08-27 Thread Lamonte Harris
Okay, I know you've guys told me millions of times to read the manual I've read a lot of it. What do you recommend studying the most? Python is my goal for the next year in the half. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: some problems with mod_python

2007-08-27 Thread Johan
On Aug 24, 3:39 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Your problem is with Apache configuration, not with mod_python. The > AddHandler directive maps /*.py to your handler. So you have to > call .py to trigger the desired behaviour. If you want > *any* url under to be handled by mp

Re: Biased random?

2007-08-27 Thread Scott David Daniels
Ivan Voras wrote: > I have a list of items, and need to choose several elements from it, > "almost random". The catch is that the elements from the beginning > should have more chance of being selected than those at the end (how > much more? I don't care how the "envelope" of probability looks like

Re: Chaining programs with pipe

2007-08-27 Thread Gabriel Genellina
En Mon, 27 Aug 2007 05:35:51 -0300, Lawrence D'Oliveiro <[EMAIL PROTECTED]> escribi�: > In message <[EMAIL PROTECTED]>, > Gabriel > Genellina wrote: > >> On 22 ago, 11:08, Grant Edwards <[EMAIL PROTECTED]> wrote: >> >>> but I'm a Unix guy who occasionally tries >>> to ship a Windows version of

Re: "Try:" which only encompasses head of compound statement

2007-08-27 Thread Scott David Daniels
Ben Finney wrote: > [EMAIL PROTECTED] writes: > ... try to only catch exceptions from the > minimum amount of code that does one discrete action. > > try: > input_file = open(my_filename) > except IOError, exc: > print "Can't open myfile: %(exc)" % locals() > > for lin

Re: Image.open( "C:\test.jpg") is this wrong ?

2007-08-27 Thread Gabriel Genellina
En Mon, 27 Aug 2007 11:48:46 -0300, Carnell, James E <[EMAIL PROTECTED]> escribi�: >> Image.open("C:\test.jpg") # this is what I have right now. And it >> can't find the file or directory. The file is there (it is everywhere >> on my computer now!!!) Use "C:\\test.jpg" or r"C:\test.jpg" or "C:

Re: include folder

2007-08-27 Thread Zentrader
> My Linux version is: Debian GNU-Linux > My Python version is: 2.3 Reinstalling Python would be my first option. Any of the versions can be downloaded from python.org but on debian you should be able to just use apt-get or one of the GUIs for apt-get. -- http://mail.python.org/mailman/listinfo

Re: Socket - gaierror

2007-08-27 Thread Douglas Wells
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] writes: > On Aug 27, 4:22 pm, [EMAIL PROTECTED] (Douglas Wells) wrote: > > In article <[EMAIL PROTECTED]>, > > > > [EMAIL PROTECTED] writes: > > > On Aug 27, 12:32 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > > > > > Changing it to IP gives me the

Re: sorting a list of lists

2007-08-27 Thread Gabriel Genellina
En Mon, 27 Aug 2007 15:41:15 -0300, iapain <[EMAIL PROTECTED]> escribi�: >> Taking advantage of stable sorting is totally not a hack. The OP just >> tried >> the two sorting steps in the wrong order. > > I didnt say not to use stable sorting, but write a generic function > and hacky code. It is

Re: Biased random?

2007-08-27 Thread Jun-geun Park
Jun-geun Park wrote: > Ivan Voras wrote: >> Hi, >> >> I have a list of items, and need to choose several elements from it, >> "almost random". The catch is that the elements from the beginning >> should have more chance of being selected than those at the end (how >> much more? I don't care how the

Re: XML File -- dictionary edit/search

2007-08-27 Thread Nagarajan
On Aug 28, 6:15 am, -b <[EMAIL PROTECTED]> wrote: > I am trying to put together a python program that will be able to ask > for a word and its definition, then save that information into an xml > file for reference. I am not down right set on the file being in xml > format, but xml is the first thi

Re: an eval()-like exec()

2007-08-27 Thread Gabriel Genellina
En Mon, 27 Aug 2007 15:59:25 -0300, Abel Daniel <[EMAIL PROTECTED]> escribi�: > Hi! > > A python interactive interpreter works by having the user type in some > code, compiling and running that code, then printing the results. For > printing, the results are turned into strings. This last stage

Re: "Try:" which only encompasses head of compound statement

2007-08-27 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Carl Banks wrote: > Consider this: is there any other code in your program that has to do > something different based on whether you successfully opened this file > or not? If so, how will you notify it whether the call has succeeded > or not? Very often, the call

Re: Chaining programs with pipe

2007-08-27 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Gabriel Genellina wrote: > En Mon, 27 Aug 2007 05:35:51 -0300, Lawrence D'Oliveiro > <[EMAIL PROTECTED]> escribi�: > >> In message <[EMAIL PROTECTED]>, >> Gabriel Genellina wrote: >> >>> On 22 ago, 11:08, Grant Edwards <[EMAIL PROTECTED]> wrote: >>> but I'm a

Re: "Try:" which only encompasses head of compound statement

2007-08-27 Thread Ben Finney
Scott David Daniels <[EMAIL PROTECTED]> writes: > Actually, this will be followed by some foolishness because > (1) [the "print" format argument was wrong] > and > (2) [the code attempts to loop over the failed input file anyway] You're right. Shame on me for posting untested code snippets, Thank

Re: XML File -- dictionary edit/search

2007-08-27 Thread Marc 'BlackJack' Rintsch
On Mon, 27 Aug 2007 18:15:24 -0700, -b wrote: > I am trying to put together a python program that will be able to ask > for a word and its definition, then save that information into an xml > file for reference. I am not down right set on the file being in xml > format, but xml is the first thing

Python Classes

2007-08-27 Thread Lamonte Harris
How come you have to set the initialized created variables to equal the parameters, shouldn't that be default? class testing: def __init__(self,testing): self.testing = testing x = testing("testing") print x.testing How come self.testing = testing Can someone explain

Re: include folder

2007-08-27 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Raul Araya wrote: > Today while trying to install a python based program I got an > error regarding the Python.h file that should be in the /include/Phyton2.3 > folder. So I went looking for the file but it wasn't there, I mean the > whole folder /Phyton2.3 inside t

Re: Biased random?

2007-08-27 Thread Gabriel Genellina
En Mon, 27 Aug 2007 17:42:45 -0300, Ivan Voras <[EMAIL PROTECTED]> escribi�: > I have a list of items, and need to choose several elements from it, > "almost random". The catch is that the elements from the beginning > should have more chance of being selected than those at the end (how > much m

Re: Python's Suitability?

2007-08-27 Thread Kay Schluehr
On 28 Aug., 02:28, [EMAIL PROTECTED] (Michael R. Copeland) wrote: >Note that I'm not considering using the existing C/C++ code in my Web > application, because I don't know how to write a C/C++ Windows > application - and I'm sure the learning curve here is greater than > Python's. I'm a very

Re: SCF released to GPL

2007-08-27 Thread Laurent Pointal
hg a écrit : > 2) I'm desperately searching for the French NG from my client but cannot > find it ... any clue ? Maybe you can pass the message ? Done. See http://groups.google.com/group/fr.comp.lang.python/browse_frm/thread/fa4474921f77b1be/8d6150d502447510#8d6150d502447510 -- http://mail.py

<    1   2