Re: Socket Performance

2008-03-14 Thread castironpi
> > Well, lets say you have a situation where you're going to be > > alternating between sending large and small chunks of data. Is the > > solution to create a NetworkBuffer class and only call send when the > > buffer is full, always recv(8192)? > >         Or create a protocol where the first 16

Re: Spaces in path name

2008-03-14 Thread David S
Hi, Using "C:\Program Files\apache-ant-1.7.0\bin\ant.bat" just gives me the same result. David "Dennis Lee Bieber" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Fri, 14 Mar 2008 04:37:12 GMT, "David S" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > >>

Re: Socket Performance

2008-03-14 Thread Bryan Olson
[EMAIL PROTECTED] wrote: [Dennis Lee Bieber had written:] >> Or create a protocol where the first 16 bits (in network byte order) >> contain a length value for the subsequent data, and use a receive >> process that consists of: >> >> leng = ntoh(socket.recv(2)) >> data = socket.receive(leng

Re: Socket Performance

2008-03-14 Thread Bryan Olson
[EMAIL PROTECTED] wrote: > Well, lets say you have a situation where you're going to be > alternating between sending large and small chunks of data. Is the > solution to create a NetworkBuffer class and only call send when the > buffer is full, always recv(8192)? Buffering can often improve perfo

Re: getattr(foo, 'foobar') not the same as foo.foobar?

2008-03-14 Thread Peter Otten
Dave Kuhlman wrote: > Arnaud Delobelle wrote: > >> >> 4. Both points above follow from the fact that foo.bar is really a >> function call that returns a (potentially) new object: in fact what >> really happens is something like > > Arnaud and Imri, too - > > No. foo.bar is *not* really a fun

Re: Spaces in path name

2008-03-14 Thread Bryan Olson
David S wrote: > I get > > ERROR: ""C:\Program Files\apache-ant-1.7.0\bin\ant"" does not exist > > If I cut the path statement here and paste it next to a windows XP command > prompt ant is invoked. > > The python code here is > if not os.path.isfile(ANT_CMD): > error('"%s" does not

Re: Spaces in path name

2008-03-14 Thread Bryan Olson
David S wrote: > Using "C:\Program Files\apache-ant-1.7.0\bin\ant.bat" just gives me the same > result. Did you try the raw string, with the .bat extension? As in: r'C:\Program Files\apache-ant-1.7.0\bin\ant.bat' After Microsoft started allowing blanks in paths, it took them years to fix m

Re: Need Script For read multiple files(.txt) from a folder

2008-03-14 Thread Chris
On Mar 14, 8:36 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Thu, 13 Mar 2008 21:28:18 -0700 (PDT), jai_python > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > > hi frenz I  Need a Python Script For read multiple files(.txt) from a > > folder and write it in a single

Re: Need Script For read multiple files(.txt) from a folder

2008-03-14 Thread martin . laloux
use the glob module import os, glob dor = the path you want for dir, subdir, files in os.walk(dor): for file in files: if glob.fnmatch.fnmatch(file,"*.txt"): do what you want -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating a file with $SIZE

2008-03-14 Thread Bryan Olson
Robert Bossy wrote: > [EMAIL PROTECTED] wrote: >> Robert Bossy wrote: >>> Indeed! Maybe the best choice for chunksize would be the file's buffer >>> size... That bit strikes me as silly. >>> I won't search the doc how to get the file's buffer size because >>> I'm too cool to use that function

Re: List mutation method gotcha - How well known?

2008-03-14 Thread Jarek Zgoda
Lie napisał(a): >> 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 - no output >> 5) None of the above >> >> I undertake to summa

Re: how to pass the workspace ?

2008-03-14 Thread Stef Mientki
Thanks, Gary and Dennis, Dennis Lee Bieber wrote: > On Thu, 13 Mar 2008 21:35:42 +0100, Stef Mientki > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > > >> The result of globals and locals in the file is eaxctly the same and >> none of them mentions 'NewVar' and 'beer' >>

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

2008-03-14 Thread Doug Morse
Harald, Great suggestion, thanks! Unfortunately, "no help there". Adding "import multiarray" to Precision.py where you suggested (i.e., before the "from multiarray import zeros" line) did not fix the problem. I'm getting the same exception and traceback as before except, of course, on line 19 n

Re: Creating a file with $SIZE

2008-03-14 Thread Robert Bossy
Bryan Olson wrote: > Robert Bossy wrote: > >> [EMAIL PROTECTED] wrote: >> >>> Robert Bossy wrote: >>> Indeed! Maybe the best choice for chunksize would be the file's buffer size... > > That bit strikes me as silly. > The size of the chunk must be as litt

Re: merging intervals repeatedly

2008-03-14 Thread Robert Bossy
Magdoll wrote: >> One question you should ask yourself is: do you want all solutions? or >> just one? >> If you want just one, there's another question: which one? the one with >> the most intervals? any one? >> > > I actually don't know which solution I want, and that's why I keep > trying di

Re: call by reference howto????

2008-03-14 Thread Antoon Pardon
On 2008-03-13, Terry Reedy <[EMAIL PROTECTED]> wrote: > > "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

RE: Huge problem gettng MySQLdb to work on my mac mini running Macosx 10.5 Leopard

2008-03-14 Thread Robert Rawlins
Geert, I've not seen this issue myself, however, you might get a little more luck asking over on the MySQLdb mailing list as this seems to be more an issue with the db than your python code. It might be worth posting your question there too as it'll heighten your chances of finding someone who kno

Huge problem gettng MySQLdb to work on my mac mini running Macosx 10.5 Leopard

2008-03-14 Thread geert
Hi all, I have a mac mini running maocosx 10.5 leopard I want to deploy a django project on. My backend is MySQL, and I have it running as a 64- bit app. Of course, apache2 is also running as 64-bit. MySQLdb installs with the usual warnings after applying the various patches I found here and ther

Re: call by reference howto????

2008-03-14 Thread Antoon Pardon
On 2008-03-13, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > 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 t

request for Details about Dictionaries in Python

2008-03-14 Thread Saideep A V S
Hello Sir, I am a beginner level programmer in Python. I am in search of a function for 'On-Disk' Dictionaries which is similar to On-Disk Hash tables in Perl (i.e., tie function in Perl). Could anyone help me with the concept. I have also searched the net, but was not successful in fin

Re: sorting question

2008-03-14 Thread Steven D'Aprano
On Thu, 13 Mar 2008 22:37:00 -0500, "Andrew Rekdal" wrote: > Seems 'KEYBOARDS' works nicely in reply to a post from "jcnbp8k" who wrote: > > That's easy solved, the word is keyboards. Hmmm... using my incredible powers of deduction, I predict that the word is "keyboards". -- Steven -- http

How to import custom python file in python server page (psp) ?

2008-03-14 Thread James Yu
Hi folks, I prepared a python script for dynamically get the absolute paths of the files in certain folder. Then I tried to invoke that function from my web server in a .psp file like this: 1 2 3 asdfasdfasdfa 4 5 <% 6 import glob 7 import os 8 *

Re: escape string to store in a database?

2008-03-14 Thread Bryan Olson
[EMAIL PROTECTED] wrote: > how would this work with UPDATE > command? I get this error: > > cmd = "UPDATE items SET content = ? WHERE id=%d" % id > > self.cursor.execute(cmd, content) > pysqlite2.dbapi2.ProgrammingError: Incorrect number of bindings > supplied. The c > rrent statement

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

2008-03-14 Thread Benjamin Watine
Bryan Olson a écrit : > 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 selec

Re: Spaces in path name

2008-03-14 Thread David S
Hi, Gets me further but still seems to be issue with space after 'Program' as code tries to run 'C:\Program'. Don't understand what is going on here... using "java.exe" from "C:\Program Files\Java\jdk1.6.0_01" using "C:\Program Files\apache-ant-1.7.0\bin\ant.bat" for building Building from E:\Re

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

2008-03-14 Thread Peter Otten
Doug Morse wrote: > from multiarray import zeros > import string > > typecodes = {'Character':'c', 'Integer':'1sil', 'UnsignedInteger':'bwu', > 'Float':'fd', 'Complex':'FD'} > > def _get_precisions(typecodes): >     lst = [] >     for t in typecodes: >         lst.append( (zeros( (1,), t ).items

anydbm and sync'ing

2008-03-14 Thread Torsten Bronger
Hallöchen! A TurboGears process opens a DB file with anydbm and keeps it open. The the same time, this file is updated by another process. How can I tell the TurboGears process to fetch the new values? my_db.sync() didn't help -- apparently, it only *writes* to the DB file but doesn't read new d

The best computer solutions

2008-03-14 Thread [EMAIL PROTECTED]
http://r8p.org/upload/213.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Spaces in path name

2008-03-14 Thread Tim Golden
David S wrote: > Gets me further but still seems to be issue with space after 'Program' as > code tries to run 'C:\Program'. Don't understand what is going on here... Slight apologies as I haven't followed this thread closely, but using the Acrobat Reader executable, which is, I think, good enou

Re: sorting question

2008-03-14 Thread Stefan Behnel
Steven D'Aprano wrote: > On Thu, 13 Mar 2008 22:37:00 -0500, "Andrew Rekdal" wrote: > >> Seems 'KEYBOARDS' works nicely > > in reply to a post from "jcnbp8k" who wrote: > >>> That's easy solved, the word is keyboards. > > Hmmm... using my incredible powers of deduction, I predict that the word

Re: Huge problem gettng MySQLdb to work on my mac mini running Macosx 10.5 Leopard

2008-03-14 Thread martin . laloux
look at http://groups.google.be/group/comp.lang.python/browse_thread/thread/d75a491b8dbc3880/0ca1fb7f7deca194?hl=fr&lnk=gst&q=laloux#0ca1fb7f7deca194 There is a macpython list that you can consult at http://www.nabble.com/Python---pythonmac-sig-f2970.html -- http://mail.python.org/mailman/listinf

Re: How do I iterate over items in a dict grouped by N number of elements?

2008-03-14 Thread Arnaud Delobelle
On Mar 14, 1:34 am, Noah <[EMAIL PROTECTED]> wrote: > What is the fastest way to select N items at a time from a dictionary? > I'm iterating over a dictionary of many thousands of items. > I want to operate on only 100 items at a time. > I want to avoid copying items using any sort of slicing. > Do

Re: This actually works.

2008-03-14 Thread Dustan
On Mar 13, 6:19 pm, "Dotan Cohen" <[EMAIL PROTECTED]> wrote: > On 14/03/2008, Dustan <[EMAIL PROTECTED]> wrote: > > > you.screw() > > Ah, you are pushing sex pills. > > > self.thank(God, encapsulation) > > And bibles? Interesting combination. > > > not self.want_to_know(you.screw.func_code) > >

Re: List mutation method gotcha - How well known?

2008-03-14 Thread Dustan
On Mar 13, 1:56 pm, yoz <[EMAIL PROTECTED]> wrote: > This will cause a hidden feature of python and the OS, known as the > 'python easter egg', to activate - erasing all data on the hard disk and > then reporting how many bytes of data are left. > > Usually "None" ;-} - This really is a 'gotcha'...

Re: request for Details about Dictionaries in Python

2008-03-14 Thread Gerardo Herzig
Saideep A V S wrote: >Hello Sir, > > I am a beginner level programmer in Python. I am in search of a >function for 'On-Disk' Dictionaries which is similar to On-Disk Hash tables >in Perl (i.e., tie function in Perl). > > > Could anyone help me with the concept. I have also searched the net,

Re: Creating a file with $SIZE

2008-03-14 Thread Bryan Olson
Robert Bossy wrote: > Bryan Olson wrote: >> Robert Bossy wrote: Robert Bossy wrote: > Indeed! Maybe the best choice for chunksize would be the file's buffer > size... >> >> That bit strikes me as silly. >> > The size of the chunk must be as little as possible in or

Re: Update pytz timezone definitions

2008-03-14 Thread Matt Nordhoff
_robby wrote: > 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,

Re: getattr(foo, 'foobar') not the same as foo.foobar?

2008-03-14 Thread Bruno Desthuilliers
Dave Kuhlman a écrit : > Arnaud Delobelle wrote: > >> 4. Both points above follow from the fact that foo.bar is really a >> function call that returns a (potentially) new object: in fact what >> really happens is something like > > Arnaud and Imri, too - > > No. foo.bar is *not* really a funct

Re: getattr(foo, 'foobar') not the same as foo.foobar?

2008-03-14 Thread Bruno Desthuilliers
Mel a écrit : (snip) > (What Diez said.) From what I've seen, f.bar creates a bound method > object by taking the unbound method Foo.bar and binding its first > parameter with f. Nope. it's Foo.__dict__['bar'] (that is, the function bar defined in the namespace of class Foo) that creates a bo

Re: getattr(foo, 'foobar') not the same as foo.foobar?

2008-03-14 Thread Bruno Desthuilliers
Erik Max Francis a écrit : > Dave Kuhlman wrote: > >> Basically, the above code is saying that foo.foobar is not the same as >> getattr(foo, 'foobar'). > > Python promises that the behavior is the same. It does not promise that > the _objects_ will be the same, which is what `is` determines. T

Urgent : How to do memory leaks detection in python ?

2008-03-14 Thread Pradeep Rai
Dear All, I am working on the python tools that process a huge amount of GIS data. These tools encountering the problem of memory leaks. Please suggest what are the different ways to detect the memory leaks in python ? This is very critical problem for me. Help needed urgently. Thanks & Regards

find string in file

2008-03-14 Thread fminervino
Hi friends !! I'm neophite about python, my target is to create a programa that find a specific string in text file. How can do it? Thanks fel -- http://mail.python.org/mailman/listinfo/python-list

Urgent : How to do memory leaks detection in python ?

2008-03-14 Thread Pradeep Rai
Dear All, I am working on the python tools that process a huge amount of GIS data. These tools encountering the problem of memory leaks. Please suggest what are the different ways to detect the memory leaks in python ? This is very critical problem for me. Help needed urgently. Thanks & Regards

Re: find string in file

2008-03-14 Thread kaerbuhez
On 14 mar, 14:25, [EMAIL PROTECTED] wrote: > Hi friends !! > > I'm neophite about python, my target is to create a programa that > find a specific string in text file. > How can do it? > > Thanks > fel $ cat text.txt aaa bbb ccc ddd aaa bbb ccc ddd aaa bbb ccc ddd aaa eee bbb eee ccc eee ddd eee

Re: find string in file

2008-03-14 Thread Tim Chase
> I'm neophite about python, my target is to create a programa that > find a specific string in text file. > How can do it? >>> FNAME1 = 'has.txt' >>> FNAME2 = 'doesnt_have.txt' >>> TEXT = 'thing to search for' >>> TEXT in file(FNAME1).read() True >>> TEXT in file(FNAME2).read() False or th

Urgent : How to do memory leaks detection in python ?

2008-03-14 Thread Pradeep Rai
Dear All, I am working on the python tools that process a huge amount of GIS data. These tools encountering the problem of memory leaks. Please suggest what are the different ways to detect the memory leaks in python ? This is very critical problem for me. Help needed urgently. Thanks & Regards

Re: find string in file

2008-03-14 Thread Michael Wieher
2008/3/14, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > Hi friends !! > > I'm neophite about python, my target is to create a programa that > find a specific string in text file. > How can do it? > > Thanks > fel > > -- > http://mail.python.org/mailman/listinfo/python-list > If your only goal is to

Re: request for Details about Dictionaries in Python

2008-03-14 Thread Gerardo Herzig
Saideep A V S wrote: >Hello Sir, > > Thank You a ton. I was looking for this function. As far what I've >understood from the "Shelve" module is that, there would be no memory >wastage and the whole transactions would be done from and to the file we >specify. Am I right?. > > My actual task is t

Re: find string in file

2008-03-14 Thread Roman Dodin
On 14 mar, 14:25, [EMAIL PROTECTED] wrote: >> Hi friends !! >> >> I'm neophite about python, my target is to create a programa that >> find a specific string in text file. >> How can do it? >> >> Thanks >> fel >> > > > One more way to do this f = codecs.open("log.txt", 'r', "utf_16_le")

Re: request for Details about Dictionaries in Python

2008-03-14 Thread Michael Wieher
2008/3/14, Gerardo Herzig <[EMAIL PROTECTED]>: > > Saideep A V S wrote: > > >Hello Sir, > > > > Thank You a ton. I was looking for this function. As far what I've > >understood from the "Shelve" module is that, there would be no memory > >wastage and the whole transactions would be done from and

Re: Urgent : How to do memory leaks detection in python ?

2008-03-14 Thread Michael Wieher
2008/3/14, Pradeep Rai <[EMAIL PROTECTED]>: > > Dear All, > > I am working on the python tools that process a huge amount of GIS data. > These tools encountering the problem of memory leaks. > > Please suggest what are the different ways to detect the memory leaks in > python ? > > This is very cri

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

2008-03-14 Thread Doug Morse
Peter, Genius! You nailed it -- thanks! py2exe is apparently getting confused by the fact that packages "Numeric" and "numpy" both have files multiarray.pyd and umath.pyd. It copies just one of each -- from $PYTHONHOME/Lib/site-packages/numpy/core -- and puts both of them into the top-level of

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

2008-03-14 Thread Floris Bruynooghe
On Mar 14, 11:37 am, Benjamin Watine <[EMAIL PROTECTED]> wrote: > Bryan Olson a écrit : > > > 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 re

Re: escape string to store in a database?

2008-03-14 Thread jim-on-linux
> > -- > > Carsten > > Haesehttp://informixdb.sourceforge.net > > Thanks for the reply, Carsten, how would > this work with UPDATE command? I get this > error: > > cmd = "UPDATE items SET content = > ? WHERE id=%d" % id try this; ("update items set contents = (?) where id =(?)", [ x, y]

how to parse a wiki markup file

2008-03-14 Thread Vinay Aiya
hello, Anyone can help me how to extract the data from wiki file using python i.e is there any WIKIPARSER package and documentation to from parsing on wiki file . -- http://mail.python.org/mailman/listinfo/python-list

RE: Urgent : How to do memory leaks detection in python ?

2008-03-14 Thread Bronner, Gregory
This is not entirely true: Symptoms of increasing memory usage are either because a) you are keeping too much data around in user accessable memory (likely) b) you are creating self-referential structures that are not garbage collected (also likely) c) You have memory leaks in underlying C extens

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

2008-03-14 Thread Doug Morse
Hi, Well, my attempt to not use the --skip-archive option didn't get very far, as I quickly noticed that "library.zip" does NOT contain ANY .pyd files. I'm guessing that they can't be in library.zip for a reason (i.e., they are DLL files, essentially, and thus must be readily available to be loade

Re: catching object

2008-03-14 Thread Igor V. Rafienko
[ [EMAIL PROTECTED] ] [ ... ] > I think inheritance is meant in reference to the Exception tree here. So, > the uppermost class is `BaseException`. Python 3 gives this exception > when trying to handle `object`:: > > TypeError: catching classes that do not inherit from BaseException is >

%x unsigned?

2008-03-14 Thread Hrvoje Niksic
The %x conversion specifier is documented in http://docs.python.org/lib/typesseq-strings.html as "Unsigned hexadecimal (lowercase)." What does "unsigned" refer to? >>> '0x%x' % 10 '0xa' >>> '0x%x' % -10 '0x-a' Is this a bug or is %x misdocumented? -- http://mail.python.org/mailman/listinfo/pyth

Re: %x unsigned?

2008-03-14 Thread D'Arcy J.M. Cain
On Fri, 14 Mar 2008 16:00:07 +0100 Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > The %x conversion specifier is documented in > http://docs.python.org/lib/typesseq-strings.html as "Unsigned > hexadecimal (lowercase)." What does "unsigned" refer to? > > >>> '0x%x' % 10 > '0xa' > >>> '0x%x' % -10 > '0

Re: %x unsigned?

2008-03-14 Thread Richard Brodie
"Hrvoje Niksic" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The %x conversion specifier is documented in > http://docs.python.org/lib/typesseq-strings.html as "Unsigned > hexadecimal (lowercase)." What does "unsigned" refer to? It's obsolete, a fallout of int/long int unificat

ANN: Leo 4.4.8 beta 2 released

2008-03-14 Thread Edward K Ream
Leo 4.4.8 beta 2 is available at: http://sourceforge.net/project/showfiles.php?group_id=3458&package_id=29106 This version features a new ipython plugin that provides a two-way bridge between Leo and IPython. See http://webpages.charter.net/edreamleo/IPythonBridge.html Leo is a text editor, dat

Re: urllib proxy support confusion

2008-03-14 Thread Mark Dickinson
On Mar 11, 11:35 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > Reading through the doc athttp://docs.python.org/lib/module-urllib.html, > there are several paragraphs (including code examples) showing > how you specify what proxies to use when calling urlopen(): See http://bugs.python.org/issue22

Re: %x unsigned?

2008-03-14 Thread Jonathan Gardner
On Mar 14, 8:00 am, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > The %x conversion specifier is documented > inhttp://docs.python.org/lib/typesseq-strings.htmlas "Unsigned > hexadecimal (lowercase)."  What does "unsigned" refer to? > > >>> '0x%x' % 10 > '0xa' Somewhat unrelated, but have you seen t

Re: Monitoring SSHd and web servers?

2008-03-14 Thread Jonathan Gardner
On Mar 13, 11:32 pm, Gilles Ganault <[EMAIL PROTECTED]> wrote: > I'd like to monitor connections to a remote SSH and web server. Does > someone have some code handy that would try to connect every 5mn, and > print an error if the script can't connect? from time import sleep while True: # Try to

Re: find string in file

2008-03-14 Thread eMko
An of course, you can use a regular expression. (Module "re"). -- http://mail.python.org/mailman/listinfo/python-list

Re: Monitoring SSHd and web servers?

2008-03-14 Thread Shane Geiger
I would recommend using a tried-and-true solution for making sure your uptime of various services is maximized (if that's what your goal is). Running a local "daemon-monitoring daemon" is one option--monit does a good job. Checking services over the network, as nagios does well, is another soluti

Re: Need Script For read multiple files(.txt) from a folder

2008-03-14 Thread Jeff Schwab
Chris wrote: > On Mar 14, 8:36 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: >> On Thu, 13 Mar 2008 21:28:18 -0700 (PDT), jai_python >> <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: >> >>> hi frenz I Need a Python Script For read multiple files(.txt) from a >>> folder and wri

Re: request for Details about Dictionaries in Python

2008-03-14 Thread Matt Nordhoff
Michael Wieher wrote: > I'm not sure if a well-written file/seek/read algorithm is faster than a > relational database... > sure a database can store relations and triggers and all that, but if > he's just doing a lookup for static data, then I'm thinking disk IO is > faster for him? not sure I w

Thousand Seperator

2008-03-14 Thread ewanfisher
I'm trying to find some code that will turn: 100 -> 100 1000 -> 1,000 100 -> 1,000,000 -1000 -> -1,000 I know that can be done using a regular expression. In Perl I would do something like: sub thousand { $number = reverse $_[0]; $number =~ s/(\d\d\d)(?=\d)(?!d*\.)/$1,/g;

Re: request for Details about Dictionaries in Python

2008-03-14 Thread Tim Golden
Matt Nordhoff wrote: > Michael Wieher wrote: >> I'm not sure if a well-written file/seek/read algorithm is faster than a >> relational database... >> sure a database can store relations and triggers and all that, but if >> he's just doing a lookup for static data, then I'm thinking disk IO is >> fa

Re: Thousand Seperator

2008-03-14 Thread Paul Rubin
[EMAIL PROTECTED] writes: > 100 -> 100 > 1000 -> 1,000 > 100 -> 1,000,000 > -1000 -> -1,000 def sep(n): if n<0: return '-' + sep(-n) if n<1000: return str(n) return '%s,%03d' % (sep(n//1000), n%1000) -- http://mail.python.org/mailman/listinfo/python-list

Re: Thousand Seperator

2008-03-14 Thread Eddie Corns
[EMAIL PROTECTED] writes: >I'm trying to find some code that will turn: >100 -> 100 >1000 -> 1,000 >100 -> 1,000,000 >-1000 -> -1,000 >I know that can be done using a regular expression. In Perl I would do >something like: >sub thousand { >$number = reverse $_[0]; >$number =

Some thoughts on defining built-in types

2008-03-14 Thread Leszek Dubiel
To define a one-element set you write:     >>> set([1]) To define one-element tuple you write:     >>> (1,) Wouldn't it be better to write:         >>> tuple(1) ? To make life easy Python gives us some powerfull syntax to define some builtin types. For example:         >>> [1, 2] 

Re: Problem with exec

2008-03-14 Thread Justus Schwabedal
On Mar 14, 2008, at 4:41 AM, [EMAIL PROTECTED] wrote: > On Mar 14, 9:47 am, Justus Schwabedal <[EMAIL PROTECTED]> > wrote: > [snipped] >> However when I do this: >> >> bash-3.2$ cat execBug2.py >> #! /usr/bin/python >> header=""" >> from scipy import randn >> def f(): >> return randn() >>

Re: Thousand Seperator

2008-03-14 Thread Shane Geiger
http://aspn.activestate.com/ASPN/docs/ActivePython/2.4/python/lib/decimal-recipes.html Eddie Corns wrote: > [EMAIL PROTECTED] writes: > > >> I'm trying to find some code that will turn: >> > > >> 100 -> 100 >> 1000 -> 1,000 >> 100 -> 1,000,000 >> -1000 -> -1,000 >> > > >

"Open with IDLE" Missing

2008-03-14 Thread fireball
I installed Parallels Desktop and Win XP Pro on my iMac for testing purposes. I installed Python 2.5.2, wxPython, and PythonCard. I cannot get the "Open with IDLE" in an Explorer window to work. All the registry entries are there too. Any ideas? Thanks! Jay -- http://mail.python.org/mailman/l

RIP: Joseph Weizenbaum

2008-03-14 Thread Aahz
Creator of Eliza: http://www-tech.mit.edu/V128/N12/weizenbaum.html -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ "It is easier to optimize correct code than to correct optimized code." --Bill Harlan -- http://mail.python.org/mailman/listinfo/python-list

Re: Monitoring SSHd and web servers?

2008-03-14 Thread Pacman
Gilles Ganault <[EMAIL PROTECTED]> wrote: >I'd like to monitor connections to a remote SSH and web server. Does >someone have some code handy that would try to connect every 5mn, and >print an error if the script can't connect? This script has been pretty reliable for us for the past few years, mu

Re: Thousand Seperator

2008-03-14 Thread Jeroen Ruigrok van der Werven
-On [20080314 18:11], [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote: >But I cannot find how to do this in Python. I am not sure of your goal, but if you need this for localization purposes, look at Babel (http://babel.edgewall.org/). In particular http://babel.edgewall.org/wiki/ApiD

Re: Thousand Seperator

2008-03-14 Thread Paul M¢Nett
Eddie Corns wrote: > [EMAIL PROTECTED] writes: > >> I'm trying to find some code that will turn: > >> 100 -> 100 >> 1000 -> 1,000 >> 100 -> 1,000,000 >> -1000 -> -1,000 > >> I know that can be done using a regular expression. In Perl I would do >> something like: > >> sub thousand { >>

Re: List mutation method gotcha - How well known?

2008-03-14 Thread Lie
On Mar 14, 4:57 pm, Jarek Zgoda <[EMAIL PROTECTED]> wrote: > Lie napisa³(a): > > > > >> 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

RE: Joseph Weizenbaum

2008-03-14 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Aahz > Sent: Friday, March 14, 2008 2:05 PM > To: python-list@python.org > Subject: RIP: Joseph Weizenbaum > > Creator of Eliza: > > http://www-tech.mit.edu/V128/N12/weizenbaum.html > -- How d

Custom Exception Value?

2008-03-14 Thread erikcw
Hi, When I use sys.exc_info() on one of my custom exception classes, the "message"/value isn't returned. But it is when I use a built in exception. Example: In [32]: class Test(Exception): : def __init__(self, x): : self.value = x : def __str__(self): ...

Re: Handling global variables (Newbie)

2008-03-14 Thread MRAB
On Mar 13, 4:25 am, "David S" <[EMAIL PROTECTED]> wrote: > Hi, > > I have an error occurring at > self.build_root = os.path.abspath(os.path.split(__file__)[0]) > > The error states 'NameError: global name '__file__' is not defined' > > In Python 2.5 I ran my script as a module in IDLE gui.

Re: ZSI and attachments

2008-03-14 Thread Dieter Maurer
Laszlo Nagy <[EMAIL PROTECTED]> writes on Tue, 11 Mar 2008 15:59:36 +0100: > I wonder if the newest ZSI has support for attachments? Last time I > checked (about a year ago) this feature was missing. I desperately > need it. Alternatively, is there any other SOAP lib for python that > can handle at

Re: unitests don't run under pdb

2008-03-14 Thread Amit Gupta
On Feb 20, 8:51 pm, Miki <[EMAIL PROTECTED]> wrote: > Hello Amit, > > > > > python testname.py : the unitests runs as usual and I get the > > following results: > > -- > > Ran 2 tests in 0.024s > > > OK > >

Re: Custom Exception Value?

2008-03-14 Thread Arnaud Delobelle
On Mar 14, 6:47 pm, erikcw <[EMAIL PROTECTED]> wrote: > Hi, > > When I use sys.exc_info() on one of my custom exception classes, the > "message"/value isn't returned.  But it is when I use a built in > exception. > > Example: > > In [32]: class Test(Exception): >    :     def __init__(self, x):

Re: How to import custom python file in python server page (psp) ?

2008-03-14 Thread Joshua Kugler
James Yu wrote: > Hi folks, > > I prepared a python script for dynamically get the absolute paths of the > files in certain folder. > Then I tried to invoke that function from my web server in a .psp file > like this: > > 1 > 2 > 3 asdfasdfasdfa > 4 > 5 <% >

Re: ZSI and attachments

2008-03-14 Thread Waldemar Osuch
On Mar 11, 8:59 am, Laszlo Nagy <[EMAIL PROTECTED]> wrote: > Hi All, > > I wonder if the newest ZSI has support for attachments? Last time I > checked (about a year ago) this feature was missing. I desperately need > it. Alternatively, is there any other SOAP lib for python that can > handle atta

Installing Python2.4 on RHEL4?

2008-03-14 Thread Eric B.
Hi, I appologize if this is slightly OT, but I am really struggling to figure out how to install Python2.4 on RHEL4. To make matters worse, the RHEL4 machine is a 64bit architecture. I search pyvault, but they only have for .i386. Does anyone know where / how I can find Python2.4 for RHEL4 x

Re: Installing Python2.4 on RHEL4?

2008-03-14 Thread Jarek Zgoda
Eric B. pisze: > I appologize if this is slightly OT, but I am really struggling to figure > out how to install Python2.4 on RHEL4. To make matters worse, the RHEL4 > machine is a 64bit architecture. > > I search pyvault, but they only have for .i386. Does anyone know where / > how I can fin

Re: Installing Python2.4 on RHEL4?

2008-03-14 Thread Eric B.
"Jarek Zgoda" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Eric B. pisze: > >> I appologize if this is slightly OT, but I am really struggling to figure >> out how to install Python2.4 on RHEL4. To make matters worse, the RHEL4 >> machine is a 64bit architecture. >> >> I search py

Re: Ping and ARP on both Win and Linux in Python

2008-03-14 Thread Rune Strand
On Mar 13, 9:14 pm, "Mauro \"Baba\" Mascia" <[EMAIL PROTECTED]> wrote: > 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 (

Re: Network server- / client-side messaging

2008-03-14 Thread castironpi
On Mar 2, 3:43 pm, [EMAIL PROTECTED] wrote: > ''' > Last time, we left off at: > ''' > > class InterfaceClientSide( ClientSide ): >         message= MessageDec() >         incremental= message.incremental() >         settings= AYT( .5, 3 ) >         user_act= message.out() >         def __init__( s

Re: Joseph Weizenbaum

2008-03-14 Thread castironpi
On Mar 14, 1:47 pm, "Reedick, Andrew" <[EMAIL PROTECTED]> wrote: > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:python- > > [EMAIL PROTECTED] On Behalf Of Aahz > > Sent: Friday, March 14, 2008 2:05 PM > > To: [EMAIL PROTECTED] > > Subject: RIP: Joseph Weizenbaum > > > Creator of

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

2008-03-14 Thread bryanjugglercryptographer
Floris Bruynooghe wrote: > Benjamin Watine wrote: > > Could you give me more information / examples about the two solutions > > you've proposed (thread or asynchronous I/O) ? > > The source code of the subprocess module shows how to do it with > select IIRC. Look at the implementation of the commu

Re: Joseph Weizenbaum

2008-03-14 Thread Roel Schroeven
[EMAIL PROTECTED] schreef: > On Mar 14, 1:47 pm, "Reedick, Andrew" <[EMAIL PROTECTED]> wrote: >>> Subject: RIP: Joseph Weizenbaum >>> Creator of Eliza: >>> http://www-tech.mit.edu/V128/N12/weizenbaum.html >>> -- >> How do you feel about creator of Eliza? > > What is Eliza? Does that question inte

Re: Joseph Weizenbaum

2008-03-14 Thread castironpi
On Mar 14, 5:16 pm, Roel Schroeven <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schreef: > > > On Mar 14, 1:47 pm, "Reedick, Andrew" <[EMAIL PROTECTED]> wrote: > >>> Subject: RIP: Joseph Weizenbaum > >>> Creator of Eliza: > >>>http://www-tech.mit.edu/V128/N12/weizenbaum.html > >>> -- > >> How do

Re: Joseph Weizenbaum

2008-03-14 Thread Brian Blais
On Mar 14, 2008, at Mar 14:5:59 PM, [EMAIL PROTECTED] wrote: On Mar 14, 1:47 pm, "Reedick, Andrew" <[EMAIL PROTECTED]> wrote: Subject: RIP: Joseph Weizenbaum Creator of Eliza: http://www-tech.mit.edu/V128/N12/weizenbaum.html -- How do you feel about creator of Eliza? What is Eliza?

  1   2   >