Re: mulithreaded server

2008-03-13 Thread Tim Roberts
asit <[EMAIL PROTECTED]> wrote: > >In the above program, why there is an unhandeled exception ??? Probably because the code as you posted it has at least a half-dozen mistakes. >import socket >import sys >import thread > >p=1 >PORT=11000 >BUFSIZE=1024 > >def getData(cSocket): >global stdoutlo

Re: sys.stdout assign to- bug

2008-03-13 Thread castironpi
> import sys > class ThreadedOut: >         def __init__( self, old ): >                 self._old= old >         def write( self, s ): >                 self._old.write( s ) > sys.stdout= ThreadedOut( sys.stdout ) > > Python 3.0a2 WinXP, on the console.  'a' is undeclared but error > message isn't

Re: Is there Python equivalent to Perl BEGIN{} block?

2008-03-13 Thread Alex
On Mar 12, 8:48 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > On Mar 12, 2:19 pm, Alex <[EMAIL PROTECTED]> wrote: > > > Hi all, > > > The subject says pretty much all, i would very appreciate an answer. I > > tried to search the various forums and groups, but didn't find any > > specific answer... >

Re: Class Inheritance

2008-03-13 Thread Marc 'BlackJack' Rintsch
On Thu, 13 Mar 2008 00:06:52 -0500, "Andrew Rekdal" < wrote: > Problem is layout_ext and Layout code is dependant on a Class instance > 'css'. Then pass that instance to the `Layout` class in the `__init__()` so both, the base class and the subclass use the same `CSS` instance. Ciao, Ma

Re: Creating a file with $SIZE

2008-03-13 Thread Robert Bossy
[EMAIL PROTECTED] wrote: > On Mar 12, 2:44 pm, Robert Bossy <[EMAIL PROTECTED]> wrote: > >> Matt Nordhoff wrote: >> >>> Robert Bossy wrote: >>> k.i.n.g. wrote: > I think I am not clear with my question, I am sorry. Here goes the > exact requirement. >

Re: How to port Python code into C++ code automatically?

2008-03-13 Thread Marc 'BlackJack' Rintsch
On Wed, 12 Mar 2008 20:15:32 -0700, Bo wrote: > I want to port a Python project (about 10,000 line python code) to C+ > +. Is there any automatically tool to do this kind of things? e.g., > SWIG(http://www.swig.org/)? > > Any comment is welcome! Have a look at the ShedSkin Python-to-C++ compiler

Re: call by reference howto????

2008-03-13 Thread Antoon Pardon
On 2008-02-28, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Thu, 28 Feb 2008 02:02:19 +0200, Tamer Higazi wrote: > >> Hi! >> Can somebody of you make me a sample how to define a function based on >> "call by reference" ??? > > Python doesn't do call by reference. Nor does it do call by value. Pl

Re: Class Inheritance

2008-03-13 Thread Bruno Desthuilliers
Andrew Rekdal < a écrit : > I am trying to bring functions to a class by inheritance... for instance in > layout_ext I have.. > > > --- layout_ext.py- > class Layout() > def...some function that rely on css in Layout.py It shouldn't, definitively. The Layout instance should have a r

Re: help please, splitter windows like in maya or 3ds max

2008-03-13 Thread moonrie
On Mar 13, 12:47 pm, "Andrew Rekdal" <@comcast.net> wrote: > This seems to work... split then split each side. then tandem the size. > > import wx > > class Layout(wx.Frame): > > def __init__(self, parent, id, title): > > wx.Frame.__init__(self, parent, id, title) > > sizer = wx.BoxSizer(wx.HORIZON

List mutation method gotcha - How well known?

2008-03-13 Thread Hendrik van Rooyen
Hi, I am surprised that it took me so long to bloody my nose on this one. It must be well known - and I would like to find out how well known. So here is a CLOSED BOOK multiple choice question - no RTFM, no playing at the interactive prompt: Given the following three lines of code at the inter

Re: call by reference howto????

2008-03-13 Thread Paul Rudin
Antoon Pardon <[EMAIL PROTECTED]> writes: > On 2008-02-28, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> On Thu, 28 Feb 2008 02:02:19 +0200, Tamer Higazi wrote: >> >>> Hi! >>> Can somebody of you make me a sample how to define a function based on >>> "call by reference" ??? >> >> Python doesn't do

Re: List mutation method gotcha - How well known?

2008-03-13 Thread cokofreedom
On Mar 13, 8:36 am, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote: > Hi, > > I am surprised that it took me so long to bloody my nose on this one. > > It must be well known - and I would like to find out how well known. > > So here is a CLOSED BOOK multiple choice question - no RTFM, > no playing

Re: List mutation method gotcha - How well known?

2008-03-13 Thread Peter Otten
Hendrik van Rooyen wrote: > I am surprised that it took me so long to bloody my nose on this one. > > It must be well known - and I would like to find out how well known. > > So here is a CLOSED BOOK multiple choice question - no RTFM, > no playing at the interactive prompt: > > Given the follo

Re: List mutation method gotcha - How well known?

2008-03-13 Thread Chris
On Mar 13, 9:36 am, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote: > Hi, > > I am surprised that it took me so long to bloody my nose on this one. > > It must be well known - and I would like to find out how well known. > > So here is a CLOSED BOOK multiple choice question - no RTFM, > no playing

Re: no more comparisons

2008-03-13 Thread Duncan Booth
Paul Rubin wrote: > "Terry Reedy" <[EMAIL PROTECTED]> writes: >> | I don't see what's so inefficient about it necessarily. >> >> The key function is called once per list item, for n calls total. >> The comparision function is called once per comparision. There are >>

Re: problem with Python 2.5.2 and gcc 4.3

2008-03-13 Thread Andrew MacIntyre
David P. Riedel wrote: > I tried building Python 2.5.2 using gcc 4.3.0. The build completes with no > problems but when I run 'make test', I get a > segfault part way through the test run. > > here is the last part of the output from make test > > test_softspace > test_sort > test_sqlite >

Re: List mutation method gotcha - How well known?

2008-03-13 Thread Diez B. Roggisch
Hendrik van Rooyen wrote: > Hi, > > I am surprised that it took me so long to bloody my nose on this one. > > It must be well known - and I would like to find out how well known. > > So here is a CLOSED BOOK multiple choice question - no RTFM, > no playing at the interactive prompt: > > Given

Re: List mutation method gotcha - How well known?

2008-03-13 Thread Paul Rubin
"Hendrik van Rooyen" <[EMAIL PROTECTED]> writes: > Given the following three lines of code at the interactive prompt: > > foo = [1,2,3,4] > x = foo.append(5) > print x > > What will be the output (choose one): > 4) Nothing - no output By Python convention, methods that mutate the object return

Re: List mutation method gotcha - How well known?

2008-03-13 Thread Bruno Desthuilliers
Hendrik van Rooyen a écrit : > Hi, > > I am surprised that it took me so long to bloody my nose on this one. > > It must be well known - and I would like to find out how well known. > > So here is a CLOSED BOOK multiple choice question - no RTFM, > no playing at the interactive prompt: > > Giv

Re: List mutation method gotcha - How well known?

2008-03-13 Thread Roel Schroeven
Hendrik van Rooyen schreef: > So here is a CLOSED BOOK multiple choice question - no RTFM, > no playing at the interactive prompt: > > Given the following three lines of code at the interactive prompt: > > foo = [1,2,3,4] > x = foo.append(5) > print x > > What will be the output (choose one): >

Re: List mutation method gotcha - How well known?

2008-03-13 Thread Paul Rubin
Paul Rubin writes: > "Hendrik van Rooyen" <[EMAIL PROTECTED]> writes: > > Given the following three lines of code at the interactive prompt: > > > > foo = [1,2,3,4] > > x = foo.append(5) > > print x > > > > What will be the output (choose one): > > 4) Nothing - no out

Re: List mutation method gotcha - How well known?

2008-03-13 Thread cokofreedom
Still, I suppose this is a gotcha for a lot of people, just follow the good advice Paul said; "By Python convention, methods that mutate the object return None, and also stuff that returns None doesn't generate output at the interactive prompt." And you should survive most. -- http://mail.python.

What's Going On?

2008-03-13 Thread MartinRinehart
(Accompanied by Marvin Gaye) >>> def f(list=[0]): ...list[0]+=1 ...return list[0] ... >>> f() 1 >>> f() 2 >>> f() # 'list' is a name bound to a list (mutable) so this makes sense 3 >>> f([5]) 6 >>>f() # What's Going On? 4 Off topic: Motown chief Berry Gordy tells Gaye he won't release the

Re: Is there Python equivalent to Perl BEGIN{} block?

2008-03-13 Thread Bruno Desthuilliers
Alex a écrit : (sni) > First of all thanks all for answering! > > I have some environment check and setup in the beginning of the code. > I would like to move it to the end of the script. Why ? (if I may ask...) > But I want it to > execute first, so the script will exit if the environment is no

Re: What's Going On?

2008-03-13 Thread Peter Otten
[EMAIL PROTECTED] wrote: > (Accompanied by Marvin Gaye) > def f(list=[0]): > ...list[0]+=1 > ...return list[0] > ... f() > 1 f() > 2 f() # 'list' is a name bound to a list (mutable) so this makes sense > 3 f([5]) > 6 f() # What's Going On? > 4 http://effbot.o

Re: What's Going On?

2008-03-13 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > (Accompanied by Marvin Gaye) > def f(list=[0]): > ...list[0]+=1 > ...return list[0] > ... f() > 1 f() > 2 f() # 'list' is a name bound to a list (mutable) so this makes sense > 3 f([5]) > 6 f() # What's Going On? > 4 That the same d

Re: help please, splitter windows like in maya or 3ds max

2008-03-13 Thread John at Quintivity
Sounds like this might do exactly what you need... http://xoomer.alice.it/infinity77/main/FourWaySplitter.html Cheers, John On Thu, Mar 13, 2008 at 1:45 AM, moonrie <[EMAIL PROTECTED]> wrote: > On Mar 13, 12:47 pm, "Andrew Rekdal" <@comcast.net> wrote: > > This seems to work... split then spli

How to send a var to stdin of an external software

2008-03-13 Thread Benjamin Watine
Hi the list, I need to send a var to stdin of an external soft ("cat" command for example). How can I do this ? I would like a function like that : theFunction ('cat -', stdin=myVar) I don't need to get any return value. Another related question : Is there's a limitation of var size ?

subprocess.Popen pipeline bug?

2008-03-13 Thread Marko Rauhamaa
This tiny program hangs: #!/usr/bin/env python import subprocess a = subprocess.Popen('cat',shell = True,stdin = subprocess.PIPE, stdout = subprocess.PIPE) b = subprocess.Popen('cat >/dev/null',shell = T

Re: How to send a var to stdin of an external software

2008-03-13 Thread Marko Rauhamaa
Benjamin Watine <[EMAIL PROTECTED]>: > How can I do this ? I would like a function like that : > > theFunction ('cat -', stdin=myVar) > > Another related question : Is there's a limitation of var size ? I > would have var up to 10 MB. import subprocess myVar = '*' * 1000 cat = subproce

Diary of a Stripper.

2008-03-13 Thread MSmith
Hi, my name is Michelle, I'm 27, just left being a secretary to become a stripper, and looking for friends to talk to. I love meeting new people! I also have a blog where I talk about my life... http://missxxy.blogspot.com Talk to you soon! Michelle -- http://mail.python.org/mailman/listinfo/py

Re: List mutation method gotcha - How well known?

2008-03-13 Thread Dustan
On Mar 13, 2:36 am, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote: > Hi, > > I am surprised that it took me so long to bloody my nose on this one. > > It must be well known - and I would like to find out how well known. > > So here is a CLOSED BOOK multiple choice question - no RTFM, > no playing

Re: problem with Python 2.5.2 and gcc 4.3

2008-03-13 Thread David P. Riedel
Andrew MacIntyre wrote: > David P. Riedel wrote: > >> I tried building Python 2.5.2 using gcc 4.3.0. The build completes >> with no problems but when I run 'make test', I get a segfault part >> way through the test run. >> >> here is the last part of the output from make test >> >> test_softs

Re: Dispatch("Excel.Application") failed

2008-03-13 Thread Mike Driscoll
On Mar 13, 1:02 am, lialie <[EMAIL PROTECTED]> wrote: > Hi, > Maybe it 's quite simple, but I can't fix it. Do I make some mistakes in > my env setting? My excel version is 2003. > any suggestion? Thanks. > > Traceback (most recent call last): > File "testexcel.py", line 3, in ? > excel = Dispatch(

Re: Different results when running script from IDLE versus Command Line

2008-03-13 Thread Casey T
On Mar 12, 5:28 pm, Chris <[EMAIL PROTECTED]> wrote: > On Mar 12, 8:10 pm, Casey T <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > I'm new to Python and I'm having some problems with getting different > > results from my script when I run it from IDLE versus just double- > > clicking the .py file an

Re: Python - CGI - XML - XSD

2008-03-13 Thread Diez B. Roggisch
> Sorry, it was really late when i wrote this post. The file is an XSL > file. It defines HTML depending on what appears in the XML document. Then the content-type might be the culprit, yes. But testing so would have been faster than waiting for answers here... Diez -- http://mail.python.org/ma

RE: Socket Performance

2008-03-13 Thread Brian Smith
[EMAIL PROTECTED] wrote: > Sent: Wednesday, March 12, 2008 9:47 PM > To: python-list@python.org > Subject: Socket Performance > > Can anyone explain why socket performance (throughput) varies > depending on the amount of data send and recv are called with? > > For example: try creating a local c

Re: Problem with subprocess in threaded enviroment

2008-03-13 Thread dripton
On Mar 12, 12:58 pm, Ningyu Shi <[EMAIL PROTECTED]> wrote: > I'm trying to write a multi-task downloader to download files from a > website using multi-threading. I have one thread to analyze the > webpage, get the addresses of the files to be downloaded and put these > in a Queue. Then the main th

Re: How to send a var to stdin of an external software

2008-03-13 Thread Sion Arrowsmith
Benjamin Watine <[EMAIL PROTECTED]> wrote: >How can I do this ? I would like a function like that : > > theFunction ('cat -', stdin=myVar) > >I don't need to get any return value. http://docs.python.org/lib/node534.html says this is spelt myVar = subprocess.Popen(["cat", "-"], stdout=subpr

wx and pil conversion

2008-03-13 Thread azrael
A little problem. Can I directly show Pil objects "image.open("bla.jpg") in Wx or do I have to transform them. If I have to transofm them How can I do it. Pixel by pixel or is there somethin built in in pil or wx or python. pilj->wx and wx->pil. -- http://mail.python.org/mailman/listinfo/python

Re: Get cgi script to begin execution of another script...

2008-03-13 Thread Sion Arrowsmith
sophie_newbie <[EMAIL PROTECTED]> wrote: >Basically I've a CGI script, that when executed by the user, I want to >call another script that does a very long running task (10 hours +) >and print a message on the screen saying that the user will be emailed >on completion of the very long task. The sc

(off-topic) JS/DHTML export to XLS format?

2008-03-13 Thread Michael Wieher
Anyone use/know of anything looks like a spreadsheet, lives in a web-browser and can export to XLS format? -- http://mail.python.org/mailman/listinfo/python-list

Re: How to send a var to stdin of an external software

2008-03-13 Thread Benjamin Watine
Marko Rauhamaa a écrit : > Benjamin Watine <[EMAIL PROTECTED]>: > >> How can I do this ? I would like a function like that : >> >> theFunction ('cat -', stdin=myVar) >> >> Another related question : Is there's a limitation of var size ? I >> would have var up to 10 MB. > > import subprocess

Re: List mutation method gotcha - How well known?

2008-03-13 Thread BJörn Lindqvist
On Thu, Mar 13, 2008 at 8:36 AM, Hendrik van Rooyen <[EMAIL PROTECTED]> wrote: > foo = [1,2,3,4] > x = foo.append(5) > print x > > What will be the output (choose one): > > 1) [1,2,3,4] > 2) [1,2,3,4,5] > 3) That famous picture of Albert Einstein sticking out his tongue > 4) Nothing - n

"Attribute Doesnt Exist" ... but.... it does :-s

2008-03-13 Thread Robert Rawlins
Hello Guys, I've got an awfully aggravating problem which is causing some substantial hair loss this afternoon J I want to get your ideas on this. I am trying to invoke a particular method in one of my classes, and I'm getting a runtime error which is telling me the attribute does not exist.

Re: "Attribute Doesnt Exist" ... but.... it does :-s

2008-03-13 Thread Chris Mellon
On Thu, Mar 13, 2008 at 10:36 AM, Robert Rawlins <[EMAIL PROTECTED]> wrote: > > > > > Hello Guys, > > > > I've got an awfully aggravating problem which is causing some substantial > hair loss this afternoon J I want to get your ideas on this. I am trying to > invoke a particular method in one of my

scons Buffer.cpp

2008-03-13 Thread brnstrmrs
I am trying to install some libs but can not get them build properly. It seems to be looking for Buffer.cpp but can't find it any where . Here is the error message: scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... g++ -o AssociationRejection.o -c

Re: "Attribute Doesnt Exist" ... but.... it does :-s

2008-03-13 Thread Robert Bossy
Robert Rawlins wrote: > > Hello Guys, > > I’ve got an awfully aggravating problem which is causing some > substantial hair loss this afternoon J I want to get your ideas on > this. I am trying to invoke a particular method in one of my classes, > and I’m getting a runtime error which is telling

Re: Creating a file with $SIZE

2008-03-13 Thread Bryan Olson
k.i.n.g. wrote: > I think I am not clear with my question, I am sorry. Here goes the > exact requirement. > > We use dd command in Linux to create a file with of required size. In > similar way, on windows I would like to use python to take the size of > the file( 50MB, 1GB ) as input from user an

RE: "Attribute Doesnt Exist" ... but.... it does :-s

2008-03-13 Thread Robert Rawlins
Hi Guys, Well thanks for the response, I followed your advice and chopped out all the crap from my class, right down to the bare __init__ and the setter method, however, the problem continued to persist. However, Robert mentioned something about unindented lines which got me thinking so I deleted

Re: What's Going On?

2008-03-13 Thread castironpi
On Mar 13, 6:12 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > (Accompanied by Marvin Gaye) > > def f(list=[0]): > > ...list[0]+=1 > > ...return list[0] > > ... > f() > > 1 > f() > > 2 > f() # 'list' is a name bound to a list (mutable) s

Re: wx and pil conversion

2008-03-13 Thread Diez B. Roggisch
azrael wrote: > A little problem. > > Can I directly show Pil objects "image.open("bla.jpg") in Wx or do I > have to transform them. > > If I have to transofm them How can I do it. Pixel by pixel or is there > somethin built in in pil or wx or python. > pilj->wx and wx->pil. PIL doesn't depend

Re: "Attribute Doesnt Exist" ... but.... it does :-s

2008-03-13 Thread Michael Wieher
2008/3/13, Robert Rawlins <[EMAIL PROTECTED]>: > > Hi Guys, > > Well thanks for the response, I followed your advice and chopped out all > the > crap from my class, right down to the bare __init__ and the setter method, > however, the problem continued to persist. > > However, Robert mentioned some

Re: Is there Python equivalent to Perl BEGIN{} block?

2008-03-13 Thread Carl Banks
On Mar 13, 7:02 am, Bruno Desthuilliers wrote: > Alex a écrit : > (sni) > > > First of all thanks all for answering! > > > I have some environment check and setup in the beginning of the code. > > I would like to move it to the end of the script. > > Why ? (if I may ask...) > > > But I want it to

Re: "Attribute Doesnt Exist" ... but.... it does :-s

2008-03-13 Thread Robert Bossy
Robert Rawlins wrote: > Hi Guys, > > Well thanks for the response, I followed your advice and chopped out all the > crap from my class, right down to the bare __init__ and the setter method, > however, the problem continued to persist. > > However, Robert mentioned something about unindented lines

Re: wx and pil conversion

2008-03-13 Thread azrael
I thought of using Temp files but I am afraid of the JPG destorsion while saving because of the compresion.I am looking for a way to directly transform it. On Mar 13, 5:09 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > azrael wrote: > > A little problem. > > > Can I directly show Pil object

Re: How to send a var to stdin of an external software

2008-03-13 Thread Bryan Olson
Benjamin Watine wrote: > And if somebody need it : to get the stdout in a var (myNewVar), not in > the shell : > > cat = subprocess.Popen('cat', shell = True, stdin = subprocess.PIPE, > stdout=subprocess.PIPE) > cat.stdin.write(myVar) > cat.stdin.close() > cat.wait() > myNewVar = cat.stdout.read

Re: no more comparisons

2008-03-13 Thread Alan Isaac
Dan Bishop wrote: > def cmp_key(cmp_fn): > class CmpWrapper(object): > def __init__(self, obj): > self.obj = obj > def __cmp__(self, other): > return cmp_fn(self.obj, other.obj) > return CmpWrapper Apparently I'm overlooking something obviou

Re: no more comparisons

2008-03-13 Thread Carl Banks
On Mar 13, 12:38 pm, Alan Isaac <[EMAIL PROTECTED]> wrote: > Dan Bishop wrote: > > def cmp_key(cmp_fn): > > class CmpWrapper(object): > > def __init__(self, obj): > > self.obj = obj > > def __cmp__(self, other): > > return cmp_fn(self.obj, other.obj) > >

Re: How to send a var to stdin of an external software

2008-03-13 Thread Bryan Olson
I wrote: > [...] Pipe loops are tricky business. > > Popular solutions are to make either the input or output stream > a disk file, or to create another thread (or process) to be an > active reader or writer. Or asynchronous I/O. On Unix-like systems, you can select() on the underlying file descr

Re: Socket Performance

2008-03-13 Thread sleddd
On Mar 13, 9:33 am, "Brian Smith" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Sent: Wednesday, March 12, 2008 9:47 PM > > To: [EMAIL PROTECTED] > > Subject: Socket Performance > > > Can anyone explain why socket performance (throughput) varies > > depending on the amount of data send

RE: "Attribute Doesnt Exist" ... but.... it does :-s

2008-03-13 Thread Robert Rawlins
Haha, I could use a stiff whisky myself after the stress that caused me :-) Robert -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Bossy Sent: 13 March 2008 16:10 To: python-list@python.org Subject: Re: "Attribute Doesnt Exist" ... but it does

Re: wx and pil conversion

2008-03-13 Thread Diez B. Roggisch
azrael wrote: > I thought of using Temp files but I am afraid of the JPG destorsion > while saving because of the compresion.I am looking for a way to > directly transform it. Then don't use JPEG, use PNG. It's lossless. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: wx and pil conversion

2008-03-13 Thread azrael
On Mar 13, 6:57 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > azrael wrote: > > I thought of using Temp files but I am afraid of the JPG destorsion > > while saving because of the compresion.I am looking for a way to > > directly transform it. > > Then don't use JPEG, use PNG. It's lossless.

getattr/setattr still ASCII-only, not Unicode - blows up SGMLlib from BeautifulSoup

2008-03-13 Thread John Nagle
Just noticed, again, that getattr/setattr are ASCII-only, and don't support Unicode. SGMLlib blows up because of this when faced with a Unicode end tag: File "/usr/local/lib/python2.5/sgmllib.py", line 353, in finish_endtag method = getattr(self, 'end_' + tag) Unicod

Re: Socket Performance

2008-03-13 Thread Grant Edwards
On 2008-03-13, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> > For example: try creating a local client/server (running on the same >> > computer) where the server sends the client a fixed amount of data. >> > Using method A, recv(8192) and sendall( ) with 8192 bytes >> > worth of data. Do this

Re: List mutation method gotcha - How well known?

2008-03-13 Thread Lie
On Mar 13, 2:36 pm, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote: > Hi, > > I am surprised that it took me so long to bloody my nose on this one. > > It must be well known - and I would like to find out how well known. > > So here is a CLOSED BOOK multiple choice question - no RTFM, > no playing

Re: app runs fine with interpreter, but not under py2exe

2008-03-13 Thread GHUM
Doug, > Precision.py is part of the Numeric package. AFAIKT, the problem is during > the module initialization. The first lines of Precision.py are: > > from multiarray import zeros > import string > [.] and your program is crashing on the lst.append( (zeros( (1,), t ).itemsize()*8, t) )

Re: frequency count or number of occurences of a number in an array

2008-03-13 Thread Bernard
d'oh! On 12 mar, 07:58, John Machin <[EMAIL PROTECTED]> wrote: > On Mar 12, 10:29 pm, Bernard <[EMAIL PROTECTED]> wrote: > > > > > Hey Larry, > > > that one is fairly easy: > > > >>> from array import array > > >>> array('i', [1, 2, 3, 4, 5, 1, 2]) > > >>> def count(x, arr): > > >         cpt = 0

Re: subprocess.Popen pipeline bug?

2008-03-13 Thread bryanjugglercryptographer
Marko Rauhamaa wrote: > This tiny program hangs: > > > #!/usr/bin/env python > import subprocess > a = subprocess.Popen('cat',shell = True,stdin = subprocess.PIPE, > stdout = subprocess.PIPE) > b = subproc

Re: List mutation method gotcha - How well known?

2008-03-13 Thread yoz
Dustan wrote: > On Mar 13, 2:36 am, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote: >> Hi, >> >> I am surprised that it took me so long to bloody my nose on this one. >> >> It must be well known - and I would like to find out how well known. >> >> So here is a CLOSED BOOK multiple choice question -

Re: Is there Python equivalent to Perl BEGIN{} block?

2008-03-13 Thread Jonathan Gardner
On Mar 12, 6:37 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > On Mar 12, 8:11 pm, Justus Schwabedal <[EMAIL PROTECTED]> > wrote: > > > What do you need it for anyway? I just read about it and I think it's > > useless > > in python. > > Perl, like Python, has a separate compilation and run times.  One

Re: List mutation method gotcha - How well known?

2008-03-13 Thread Arnaud Delobelle
On Mar 13, 10:42 am, Paul Rubin wrote: [...] > By Python convention, methods that mutate the object return None, and > also stuff that returns None doesn't generate output at the > interactive prompt. A convention that does not always hold: >>> l = [1, 2, 3] >>> l.pop()

Re: Is there Python equivalent to Perl BEGIN{} block?

2008-03-13 Thread Paddy
On Mar 13, 7:03 pm, Jonathan Gardner <[EMAIL PROTECTED]> wrote: > On Mar 12, 6:37 pm, Carl Banks <[EMAIL PROTECTED]> wrote: <> > > And leave out the magical -p and -n. If you want to iterate through a > file, "for line in sys.stdin:". Or better still: import fileinput for line in fileinp

Re: Is there Python equivalent to Perl BEGIN{} block?

2008-03-13 Thread Jeff Schwab
Paddy wrote: > On Mar 13, 7:03 pm, Jonathan Gardner <[EMAIL PROTECTED]> > wrote: >> On Mar 12, 6:37 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > > <> >> And leave out the magical -p and -n. If you want to iterate through a >> file, "for line in sys.stdin:". > > Or better still: > > import fil

Re: no more comparisons

2008-03-13 Thread Alan Isaac
>> Dan Bishop wrote: >>> def cmp_key(cmp_fn): >>>class CmpWrapper(object): >>>def __init__(self, obj): >>>self.obj = obj >>>def __cmp__(self, other): >>>return cmp_fn(self.obj, other.obj) >>>return CmpWrapper > On Mar 13, 12:38 pm, Alan

Python regex

2008-03-13 Thread "Andrew Rekdal"
I hope posting is ok here for this question... I am attempting to extract the text from a CSS comment using 're' such as... string = "/* CSS comment /*" exp = "[^(/*)].*[^(*/)] " p = re.compile(exp) q = p.search(string) r = q.group() print r >>CSS comment although this works to a degree... I

Re: Python regex

2008-03-13 Thread "Andrew Rekdal"
made error on last line... read as... > I would be saying if forward-slash AND asterisk appear in this order... > negate -- -- Andrew "Andrew Rekdal @comcast.net>" < wrote in message news:[EMAIL PROTECTED] >I hope posting is ok here for this question... > > I am attempting to extract the tex

Ping and ARP on both Win and Linux in Python

2008-03-13 Thread Mauro "Baba" Mascia
Hi, this is my question: I want to know if several switch (about 50) in a big lan are up and then know their MAC addresses to do a list that contains host name, ip and mac. I know only the range of their IP addresses (the host name it's simply to know using socket.gethostn. The first idea it's

Re: Python regex

2008-03-13 Thread Arnaud Delobelle
On Mar 13, 8:03 pm, "Andrew Rekdal" <@comcast.net> wrote: > I hope posting is ok here for this question... > > I am attempting to extract the text from a CSS comment using 're' such as... > > string = "/* CSS comment /*" > exp = "[^(/*)].*[^(*/)] " > > p = re.compile(exp) > q = p.search(string) > r

This actually works.

2008-03-13 Thread troyj1978
I couldn't believe it. Screw programming Python anymore! I'm totally serious. This actually works! It is SO EASY to make money this way. Anyone, and I mean ANYONE can do it. You should start seeing returns within a day or two. Do yourself a favour and at least check it out: http://agentb.af

Re: Is there Python equivalent to Perl BEGIN{} block?

2008-03-13 Thread Aahz
In article <[EMAIL PROTECTED]>, Jeff Schwab <[EMAIL PROTECTED]> wrote: > >I write maybe a dozen one-liners a day. It's not practical to do this >with Python, or at least it's not nearly as convenient as Perl. That is a defensible position, but my take is that writing the one-liners in Python

Re: Python regex

2008-03-13 Thread "Andrew Rekdal"
-- -- Andrew "Arnaud Delobelle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Mar 13, 8:03 pm, "Andrew Rekdal" <@comcast.net> wrote: > I hope posting is ok here for this question... > > I am attempting to extract the text from a CSS comment using 're' such > as... > > string

Re: This actually works.

2008-03-13 Thread Grant Edwards
On 2008-03-13, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I couldn't believe it. Screw programming Python anymore! OMG, IT'S FREE MONEY! I guess you've got to give the wanker credit for actually mention Python programming. :) -- Grant -- http://mail.python.org/mailman/listinfo/python-lis

Re: Python regex

2008-03-13 Thread Arnaud Delobelle
On Mar 13, 8:22 pm, "Andrew Rekdal" <@comcast.net> wrote: [...] > in your expression above.. > > >>> r = re.compile(r'/\*(.*?)\*/') > > what does the 'r' do? It means the literal is a 'raw string' : >>> print 'Hi\nthere!' Hi there! >>> print r'Hi\nthere!' Hi\nthere! >>> If you haven't done so al

Re: how to pass the workspace ?

2008-03-13 Thread Stef Mientki
Gary Herron wrote: > Stef Mientki wrote: >> hello, >> >> I've GUI tree with drag and drop nodes, >> where each nodes contains a code snippet. >> Now I want to run one or more branches in that tree, >> so I enumerate over the nodes and have to run something like this: >> >> execfile ( node1 ) >> exe

Update pytz timezone definitions

2008-03-13 Thread _robby
I am looking at using pytz in a scheduling application which will be used internationally. I would like to be able to update the definition files that pytz uses monthly or bi-monthly. As far as I can tell, pytz seems to be updated (fairly) regularly to the newest tzdata, but I don't want to have t

Re: subprocess.Popen pipeline bug?

2008-03-13 Thread Marko Rauhamaa
[EMAIL PROTECTED]: > Not sure. I think what's happening is that the second cat subprocess > never gets EOF on its stdin, because there are still processes with an > open file descriptor for the other end of the pipe. You are right. However, the close_fds technique seems a bit heavy-handed. Well,

Python-PHP bridge?

2008-03-13 Thread erikcw
Hi all, I'm starting to translate a large legacy php app to python (django), and was wondering if anyone knew of a bridge between the 2 languages. (access php objects from python and vice versa). Some of the solutions I've come across so far include using php's passthru() ( http://us3.php.net/pas

Re: List mutation method gotcha - How well known?

2008-03-13 Thread John Machin
On Mar 14, 6:13 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > On Mar 13, 10:42 am, Paul Rubin wrote: > [...] > > > By Python convention, methods that mutate the object return None, and > > also stuff that returns None doesn't generate output at the > > interactive pro

Re: subprocess.Popen pipeline bug?

2008-03-13 Thread Douglas Wells
In article <[EMAIL PROTECTED]>, Marko Rauhamaa <[EMAIL PROTECTED]> writes: > > This tiny program hangs: > > > #!/usr/bin/env python > import subprocess > a = subprocess.Popen('cat',shell = True,stdin = subprocess.PIPE, >

Re: no more comparisons

2008-03-13 Thread Mark Dickinson
On Mar 13, 3:48 pm, Alan Isaac <[EMAIL PROTECTED]> wrote: > So maybe this is not as bad as I feared.  What are some use > > cases that will clearly be harder (i.e., at least require > > a slightly elaborate wrapper) after this change? Sorting tuples, where the second item in the tuple should have

Re: no more comparisons

2008-03-13 Thread Mark Dickinson
On Mar 13, 5:10 pm, Mark Dickinson <[EMAIL PROTECTED]> wrote: > (1, '14') represents 14 should be -14, of course. -- http://mail.python.org/mailman/listinfo/python-list

Re: [pysqlite] [ANN] pysqlite and APSW projects moved

2008-03-13 Thread CMcP
In article <[EMAIL PROTECTED]>Gerhard Häring <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > Gerhard Häring wrote: >> [...] APSW >> >> >> web:http://oss.itsystementwicklung.de/trac/apsw/ >> scm:Subversion: http://initd.org/svn/pysqlite/apsw

Re: [pysqlite] [ANN] pysqlite and APSW projects moved

2008-03-13 Thread Colin Mcphail
On 2008-03-09 18:57:00 +, Gerhard Häring <[EMAIL PROTECTED]> said: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Gerhard Häring wrote: >> [...] APSW >> >> >> web:http://oss.itsystementwicklung.de/trac/apsw/ >> scm:Subversion: http://initd.org/svn/pysqlite/apsw/trunk/ >

Re: call by reference howto????

2008-03-13 Thread Terry Reedy
"Antoon Pardon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | On 2008-02-28, Steven D'Aprano <[EMAIL PROTECTED]> wrote: | > On Thu, 28 Feb 2008 02:02:19 +0200, Tamer Higazi wrote: | > | >> Hi! | >> Can somebody of you make me a sample how to define a function based on | >> "call

Re: call by reference howto????

2008-03-13 Thread Steven D'Aprano
On Thu, 13 Mar 2008 08:54:43 +, Paul Rudin wrote: >> Whatever python has for a calling convention, it is close enough that >> naming it "call by reference" gives people a reasonable idea of what is >> going on. > > Quite. The thing is not to get hung up with the label - but to > understand wh

Re: getattr/setattr still ASCII-only, not Unicode - blows up SGMLlibfrom BeautifulSoup

2008-03-13 Thread Terry Reedy
"John Nagle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Just noticed, again, that getattr/setattr are ASCII-only, and don't support | Unicode. | | SGMLlib blows up because of this when faced with a Unicode end tag: | | File "/usr/local/lib/python2.5/sgmllib.py", line 353,

Re: getattr/setattr still ASCII-only, not Unicode - blows up SGMLlib from BeautifulSoup

2008-03-13 Thread John Machin
On Mar 14, 5:38 am, John Nagle <[EMAIL PROTECTED]> wrote: >Just noticed, again, that getattr/setattr are ASCII-only, and don't support > Unicode. > >SGMLlib blows up because of this when faced with a Unicode end tag: > > File "/usr/local/lib/python2.5/sgmllib.py", line 353, in finis

Re: Dispatch("Excel.Application") failed

2008-03-13 Thread John Machin
On Mar 13, 5:02 pm, lialie <[EMAIL PROTECTED]> wrote: > Hi, > Maybe it 's quite simple, but I can't fix it. Do I make some mistakes in > my env setting? My excel version is 2003. > any suggestion? Thanks. > > Traceback (most recent call last): > File "testexcel.py", line 3, in ? > excel = Dispatch(

  1   2   >