Re: Logging to a file and closing it again properly (logging module)

2006-06-14 Thread Amit Khemka
On 6/13/06, Christoph Haas <[EMAIL PROTECTED]> wrote: > Evening, > > I have an application that is running in an endless loop processing an > incoming queue. Every run is supposed to write a log file about the run > and then close it again. While the 'logging' module is generally working > well (ev

Re: curses module bug in windows python?

2006-06-14 Thread Tim Daneliuk
kernel1983 wrote: > when I type command below in windows python: > import curses > > it gives the error msg! It can't find _curses.pyd > > Is this a bug? > Nope - this module is not supported under Windows ... -- Tim

Re: Decimals

2006-06-14 Thread Tim Roberts
"Tgone" <[EMAIL PROTECTED]> wrote: >Sybren Stuvel wrote: >> Tgone enlightened us with: >> > Sorry, when I print out the variable it displays as '15.0'. The >> > price is '15.00' in the database though. >> >> That's the same thing, isn't it? 15.0 == 15.0 > >Yes, they're both mathematically t

Re: USB support

2006-06-14 Thread Tim Roberts
"rodmc" <[EMAIL PROTECTED]> wrote: > >I need to write a program which can access the USB ports on Mac and >Linux, is there a library available for Python? The "stable" version of Libusb includes a Python binding. The version in development does not yet. -- - Tim Roberts, [EMAIL PROTECTED] Prov

Re: curses module bug in windows python?

2006-06-14 Thread Erik Max Francis
Tim Daneliuk wrote: > Nope - this module is not supported under Windows ... There's at least one Python curses module for Windows: http://adamv.com/dev/python/curses/ -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM er

Re: Logging to a file and closing it again properly (logging module)

2006-06-14 Thread Christoph Haas
On Wed, Jun 14, 2006 at 12:29:22PM +0530, Amit Khemka wrote: > On 6/13/06, Christoph Haas <[EMAIL PROTECTED]> wrote: > >I have an application that is running in an endless loop processing an > >incoming queue. Every run is supposed to write a log file about the run > >and then close it again. While

Re: Looping through a file a block of text at a time not by line

2006-06-14 Thread Rune Strand
Rosario Morgan wrote: > Hello > > Help is great appreciated in advance. > > I need to loop through a file 6000 bytes at a time. I was going to > use the following but do not know how to advance through the file 6000 > bytes at a time. > > file = open('hotels.xml') > block = file.read(6000) > newb

Re: curses module bug in windows python?

2006-06-14 Thread Tim Daneliuk
Erik Max Francis wrote: > Tim Daneliuk wrote: > >> Nope - this module is not supported under Windows ... > > There's at least one Python curses module for Windows: > > http://adamv.com/dev/python/curses/ > Sorry, I should have been more specific: AFAIK, curses is not one of the *standard*

Re: Decimals

2006-06-14 Thread Fredrik Lundh
Tim Roberts wrote: > DECIMAL is an SQL thing. Unless the language has a native decimal type, it > cannot possibly know how to display it in the same format as your SQL. unless your database adapter returns everything as strings... -- http://mail.python.org/mailman/listinfo/python-list

Re: Looping through a file a block of text at a time not by line

2006-06-14 Thread Fredrik Lundh
Rune Strand wrote: > Probably a more terse way to do this, but this seems to work > import os > > offset = 0 > grab_size = 6000 > file_size = os.stat('hotels.xml')[6] ouch. why not just loop until f.read returns an empty string ? > f = open('hotels.xml', 'r') > > while offset < file_size: >

Re: logging magic

2006-06-14 Thread Vinay Sajip
[EMAIL PROTECTED] wrote: > Hi everyone. > > I've just been trying to add a bit more granularity to my logging code, > as the jump from INFO (level 20) to DEBUG (level 10) is a bit too big. > I was thinking of borrowing a few levels from java: fine (18), finer > (16) and finest(14). > > This is wha

Re: Logging to a file and closing it again properly (logging module)

2006-06-14 Thread Vinay Sajip
Christoph Haas wrote: > Thanks. That works great. I was looking for a way to close the log file > using logging.basicConfig but it appears that it's too much magic. > logging.getLogger() isn't really much more work but gives better > control. You may also need to close the handler - removeHandler

Re: Test functions and test discovery

2006-06-14 Thread bruno at modulix
Ben Finney wrote: (snip) > if __name__ == "__main__": > test_funcs = [x for name, x in globals() > if name.startswith("test") and hasattr(x, "__call__") > ] Any reason not to use callable(x) here ? (instead of hasattr(x, "__call__")) -- bruno desthuilliers python

Re: What is Expressiveness in a Computer Language

2006-06-14 Thread Xah Lee
hi Joe, Joe Marshall wrote: « Expressiveness isn't necessarily a good thing. For instance, in C, you can express the addresses ...» we gotta be careful here, because soon we gonna say binaries are the most expressive. For instance, in assembly, you can express the registers and stuff. Expressi

popen and password entry

2006-06-14 Thread sinan nalkaya
hello, i want to use rsync for remote file transfer via popen, but couldnt pass the Password yet. here`s what i did cmd = 'rsync -av config [EMAIL PROTECTED]:/tmp/.' f = os.popen(cmd,'w') f.write('1234') #not worked f.write('1234\n') #not worked every time i see "Password:" line, then i tried p

Re: Looping through a file a block of text at a time not by line

2006-06-14 Thread bruno at modulix
Rosario Morgan wrote: > Hello > > Help is great appreciated in advance. > > I need to loop through a file 6000 bytes at a time. I was going to > use the following but do not know how to advance through the file 6000 > bytes at a time. > > file = open('hotels.xml') while True: block = file.

Re: Earthquake and Tornado Forecasting Programs June 13, 2006

2006-06-14 Thread Steve Holden
CBFalconer wrote: > Frank Silvermann wrote: > >>[snip] >>I look forward to a day when meteorology has more to do with precise >>models than models, although I'm all for Russian-style delivery of such >>data. I forecast that a lot of people will be surprised by the weather >>today, as they are cat

determining file type

2006-06-14 Thread Ritesh Raj Sarraf
Hi, I have a funtion named unzipper() which does the work of unzipping the files. Is there a way I can identify what is the type of the file which'll be passed to unzipper(). If yes, I'll be able to make out if it's a zip file or a tar or a bz2 file. Thanks, Ritesh -- http://mail.python.org/ma

Re: python-dev Summary for 2006-05-01 through 2006-05-15

2006-06-14 Thread Neil Hodgson
Radovan: > This summary is tagged as being in ISO-8859-1 encoding: > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > However, it really is in UTF-8, which results in this mojibake: > >> Martin v. Löwis and Marc-Andre Lemburg discussed how to include both Its a good thing we

Re: Tuple Syntax and ()

2006-06-14 Thread Steve Holden
[EMAIL PROTECTED] wrote: > I keep accidently trying to declare t-tuples as mytuple = (myitem) > > I know this doesn't work and that you need the trailing comma, but > reading something online, I just came to realize the parenthesises > don't have any special meaning in relation to tuples at al

Re: TONIGHT! Lisp group beerfest in NYC, PyCells to be discussed

2006-06-14 Thread Didier Verna
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Why are all of the cool Lisp things up north? No Lispers down south? Of course there are. South of Paris, I mean. -- Didier Verna, [EMAIL PROTECTED], http://www.lrde.epita.fr/~didier EPITA / LRDE, 14-16 rue Voltaire Tel.+33 (1) 44 08

Re: popen and password entry

2006-06-14 Thread Ganesan Rajagopal
> sinan nalkaya <[EMAIL PROTECTED]> writes: > i want to use rsync for remote file transfer via popen, but couldnt pass > the Password yet. For interactive input try the pexpect module instead of popen (see http://pexpect.sf.net). Ganesan -- Ganesan Rajagopal -- http://mail.python.org/ma

Test tool - Design advise needed

2006-06-14 Thread P-O Bengtsson
Hello   I am new at this list, looking forward to be a part of it.   I am trying to write a application with the functionality to record mouse and key events, and then another functionality to replay earlier recorded events.   It is meant to be used for testing of other applications/WebPages. I s

Using "external" vars on module load time

2006-06-14 Thread Marco Aschwanden
Hi I have a script that looks for modules and tries to load them. After loading I attach the "server"-API function to it. module = __import__(module_name, globals(), locals(), []) module.server = server.server_api Now, some modules need the "server" functionality on load/init. I tried to mo

About Threading - implementation

2006-06-14 Thread Dara Durum
Hi ! I don't understand something. Under Python the threads are simulated by Python Interpreter as when prev. setted pieces (interval) of the interpreted tokens are executed, it is change to another "virtual" thread ? Or it was really create real threads, and they are figth for the priority, and

Re: determining file type

2006-06-14 Thread Maric Michaud
Le Mercredi 14 Juin 2006 11:22, Ritesh Raj Sarraf a écrit : > Hi, > > I have a funtion named unzipper() which does the work of unzipping the > files. > > Is there a way I can identify what is the type of the file which'll be > passed to unzipper(). > If yes, I'll be able to make out if it's a zip f

IPC with mmap - freezed in Windows XP terminal ?

2006-06-14 Thread Dara Durum
Hi ! I want to comm. between 2 procs with mmap - in Windows XP. Interesting thing I saw yesterday. When I start my mtest.py without redirection stdout, the program freezed. When I pushed Enter, is was released. (Just like when I use raw_input in the end of the code... :-)) For this effect I nee

Re: determining file type

2006-06-14 Thread Ritesh Raj Sarraf
But isn't there any library function ? Something like XX.filetype(name) Directory File-Tar File-Zip File-MPEG Ritesh Maric Michaud wrote: > Le Mercredi 14 Juin 2006 11:22, Ritesh Raj Sarraf a écrit : > > Hi, > > > > I have a funtion named unzipper() which does the work of unzipping the > > files

Quacker

2006-06-14 Thread Quacker
Very interesting! -- http://mail.python.org/mailman/listinfo/python-list

Greetings

2006-06-14 Thread Quacker
Nice and interesting matter! -- http://mail.python.org/mailman/listinfo/python-list

Re: About Threading - implementation

2006-06-14 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Dara Durum wrote: > Under Python the threads are simulated by Python Interpreter as when > prev. setted pieces (interval) of the interpreted tokens are executed, > it is change to another "virtual" thread ? > > Or it was really create real threads, and they are figth for t

Re: determining file type

2006-06-14 Thread Ritesh Raj Sarraf
Also, f = file ('some_file.jpg') throws an error. "str object is not callable" Ritesh Maric Michaud wrote: > Le Mercredi 14 Juin 2006 11:22, Ritesh Raj Sarraf a écrit : > > Hi, > > > > I have a funtion named unzipper() which does the work of unzipping the > > files. > > > > Is there a way I can

joining NoneType and DateTimeType

2006-06-14 Thread s99999999s2003
hi i have some databse results that are NoneType and DateTimeType. now i have trouble joining these row results together like "|".join(result) as it says cannot join NoneType , DateTimeType . How can i change these types so i can join the columns together as string? thanks -- http://mail.python.o

Re: Test functions and test discovery

2006-06-14 Thread Ben Finney
bruno at modulix <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > (snip) > > if __name__ == "__main__": > > test_funcs = [x for name, x in globals() > > if name.startswith("test") and hasattr(x, "__call__") > > ] > > Any reason not to use callable(x) here ? (inste

Re: joining NoneType and DateTimeType

2006-06-14 Thread Simon Brunning
On 14 Jun 2006 03:43:39 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > i have some databse results that are NoneType and DateTimeType. now i > have trouble > joining these row results together like "|".join(result) as it says > cannot join NoneType , DateTimeType . How can i change these typ

Re: Correctly reading stdout/stderr from subprocess

2006-06-14 Thread Maric Michaud
Le Mercredi 14 Juin 2006 00:20, Christoph Haas a écrit : > Evening, > > I'm having trouble with running a process through Python 2.4's > subprocess module. Example code: > > > def run(command): >run = subprocess.Popen(command, shell=True,

Re: determining file type

2006-06-14 Thread Maric Michaud
Le Mercredi 14 Juin 2006 12:41, Ritesh Raj Sarraf a écrit : > Also, > f = file ('some_file.jpg') > > throws an error. > "str object is not callable" stange, did you define a function named file ? You can use open instead. -- _ Maric Michaud _ Aristote - www.aristote.info

Re: determining file type

2006-06-14 Thread Diez B. Roggisch
Ritesh Raj Sarraf schrieb: > Also, > f = file ('some_file.jpg') > > throws an error. > "str object is not callable" I bet you have rebound "file" to a string, like this: file = "some name" And PLEASE don't top-quote: http://www.redballoon.net/~snorwood/quote-rant.shtml Diez -- http://mail.

Re: determining file type

2006-06-14 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Ritesh Raj Sarraf wrote: > Also, > f = file ('some_file.jpg') > > throws an error. > "str object is not callable" This happens if you rebind names of builtins. In this case to a string. Don't do that! In [5]:file Out[5]: In [6]:file = 'foo.txt' In [7]:file Out[7]:'fo

Re: Bundling an application with third-party modules

2006-06-14 Thread utabintarbo
A couple of alternatives: 1. py2exe/csFreeze-type thing. This would even relieve the customer of installing python 2. An Installshield-type installer can place files (essentially) wherever you want them HTH -- http://mail.python.org/mailman/listinfo/python-list

Re: determining file type

2006-06-14 Thread Sion Arrowsmith
Ritesh Raj Sarraf <[EMAIL PROTECTED]> wrote: >Also, >f =3D file ('some_file.jpg') > >throws an error. >"str object is not callable" You know all the times people say in this group "Don't use list or str or file[HINT] or anything else that shadows a built in as a variable name"? Now you know why.

Numerics, NaNs, IEEE 754 and C99

2006-06-14 Thread Nick Maclaren
The numerical robustness of Python is very poor - this is not its fault, but that of IEEE 754 and (even more) C99. In particular, erroneous numerical operations often create apparently valid numbers, and the NaN state can be lost without an exception being raised. For example, try int(float("nan

File read and writing in binary mode...

2006-06-14 Thread nicolasg
Hi, I'm trying to open a file (any file) in binary mode and save it inside a new text file. After that I want to read the source from the text file and save it back to the disk with its original form. The problem is tha the binary source that I extract from the text file seems to be diferent from

Re: File read and writing in binary mode...

2006-06-14 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > Hi, > > I'm trying to open a file (any file) in binary mode and save it inside > a new text file. > After that I want to read the source from the text file and save it > back to the disk with its original form. The problem is tha the binary > source that I extract from

Re: convert .pdf files to .txt files

2006-06-14 Thread Davor
Thanks for all you wrote, It will be very usefull to me, at the end I use that code and the file I introduce is converted to .txt on the directory where the file is placed, and in documents written in spanish this do not gives problems on "acentos" in words like "camión" or "introducción" that was

Re: Using "external" vars on module load time

2006-06-14 Thread Peter Otten
Marco Aschwanden wrote: > Load a module and hand in already the server_api. How can I achieve this? Using execfile() is the simplest approach: import imp import sys def import_preloaded(name, path=None, variables={}): if path is None: file, path, description = imp.find_module(name)

Tiddlywiki type project in Python?

2006-06-14 Thread jkn
Hi all I'm trying out, and in general finding really useful, the various TiddlyWiki variants that I guess many people here know about, for organising my activities in a GTD way. One mild annoyance is in the speed of the Javascript applications. I fancy having a go at writing something like this

Re: Tiddlywiki type project in Python?

2006-06-14 Thread bruno at modulix
jkn wrote: > Hi all > I'm trying out, and in general finding really useful, the various > TiddlyWiki variants that I guess many people here know about, for > organising my activities in a GTD way. One mild annoyance is in the > speed of the Javascript applications. I fancy having a go at writin

Re: Using "external" vars on module load time

2006-06-14 Thread Marco Aschwanden
Marvelous that was the solution I was looking for. > I think you should consider a class instead of a module, though. What I don't get: Why should I consider using a class? Greetings from sunny Switzerland, Marco -- http://mail.python.org/mailman/listinfo/python-list

Re: Using "external" vars on module load time

2006-06-14 Thread Fredrik Lundh
Marco Aschwanden wrote: > Load a module and hand in already the server_api. How can I achieve this? use execfile (or compile/exec) instead of import. -- http://mail.python.org/mailman/listinfo/python-list

Re: Tiddlywiki type project in Python?

2006-06-14 Thread jkn
Hi Bruno [...] > > > > I don't know Javascript (although it looks moderately simple from a > > brief peruse, > > It's not as simple as it may seem at first look. There are some real > gotchas. But if you want a more pythonic javascript, you should have a > look at mochikit. OK, thanks for the poi

Where is documentation for +=

2006-06-14 Thread Marco Wahl
Hello, by accident I found that += exists in python. E.g. >>> a = 0 >>> a += 42 >>> a 42 >>> a += 0.42 >>> a 42.422 >>> But I can't find any documentation for +=. Any hints? Best wishes -- http://mail.python.org/mailman/listinfo/python-list

Re: Where is documentation for +=

2006-06-14 Thread Martin Wiechert
http://docs.python.org/ref/augassign.html On Wednesday 14 June 2006 15:39, Marco Wahl wrote: > Hello, > > by accident I found that += exists in python. > E.g. > > >>> a = 0 > >>> a += 42 > >>> a > > 42 > > >>> a += 0.42 > >>> a > > 42.422 > > > But I can't find any documentation for +

Re: What is Expressiveness in a Computer Language

2006-06-14 Thread Torben Ægidius Mogensen
"Joe Marshall" <[EMAIL PROTECTED]> writes: > > On the Expressive Power of Programming Languages, by Matthias > > Felleisen, 1990. > > http://www.ccs.neu.edu/home/cobbe/pl-seminar-jr/notes/2003-sep-26/expressive-slides.pdf > > The gist of the paper is this: Some computer languages seem to be > `m

Re: Numerics, NaNs, IEEE 754 and C99

2006-06-14 Thread Grant Edwards
On 2006-06-14, Nick Maclaren <[EMAIL PROTECTED]> wrote: > > The numerical robustness of Python is very poor - this is not its fault, > but that of IEEE 754 and (even more) C99. In particular, erroneous > numerical operations often create apparently valid numbers, and the > NaN state can be lost wi

Re: [*SPAM*] Python open proxy honeypot

2006-06-14 Thread Eric S. Johansson
Alex Reinhart wrote: > Eric S. Johansson wrote: >> Alex Reinhart wrote: >>> Yeah, I just realized that. What would I do to act as an open proxy as >>> well? >> emulate the Apache proxy capability, especially the reverse proxy. >> >> more seriously, what you need to do is from common proxy and web s

Re: Correctly reading stdout/stderr from subprocess

2006-06-14 Thread Maric Michaud
Le Mercredi 14 Juin 2006 13:14, Maric Michaud a écrit : > or use a > threaded version here it is. I did it just to validate my point and because i don't use threads very often in python, some exercises can't hurt :) def run(command): import subprocess run = subprocess.Popen(command, shell

Re: Where is documentation for +=

2006-06-14 Thread Marco Wahl
> > [...] I can't find any documentation for +=. > > Any hints? > http://docs.python.org/ref/augassign.html That's it. Thank you very much. -- http://mail.python.org/mailman/listinfo/python-list

Re: Trace KeyboardInterrupt exception?

2006-06-14 Thread andrewdalke
Tony Nelson wrote: > I'm trying to find out what is eating some KeyboardInterrupt exceptions > in a fairly large program (yum). My KeyboardInterrupt handler is called > for some Ctl-C presses, but for others nothing seems to happen. > ... I'd like to use a debugger to trace > KeyboardInterrupt e

Re: Tiddlywiki type project in Python?

2006-06-14 Thread bruno at modulix
jkn wrote: (snip) > Does the idea of embedding python in a browser instead of Javascript > make any sense at all? >From a purely theoretical POV, yes, this idea makes sens - Python could be an interesting alternative to javascript for client-side scripting (and I'd really prefer using Python for t

Re: Quacker

2006-06-14 Thread bruno at modulix
Quacker wrote: > Very interesting! > indeed. -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http://mail.python.org/mailman/listinfo/python-list

Re: wxpython: bringing up a dialog box with a button

2006-06-14 Thread John Salerno
jean-michel bain-cornu wrote: > When your button gives an event, wx send two arguments : the object > itself and an event object. So you can't bind directly. Ah, that explains it! Thank you! -- http://mail.python.org/mailman/listinfo/python-list

Re: Dr. Dobb's Python-URL! - weekly Python news and links (Jun 12)

2006-06-14 Thread John Salerno
[EMAIL PROTECTED] wrote: > John Salerno wrote: > >> I love the new 'folder' icon, but how can I access it as an icon? > > I've just given these are proper home, so here: > > http://doxdesk.com/software/py/pyicons.html > > cheers! > Thanks! -- http://mail.python.org/mailman/listinfo/python-

newbe: tuple

2006-06-14 Thread david brochu jr
I am trying to get my ip address through a script and I am using the following code:   import socket   ip = socket.gethostbyaddr(socket.gethostname())       ip then becomes a tuple and takes on three values. I am trying to pull the value of ip[2] which when printed displays: ['10.5.100.17'].   I wa

Re: Numerics, NaNs, IEEE 754 and C99

2006-06-14 Thread Nick Maclaren
In article <[EMAIL PROTECTED]>, Grant Edwards <[EMAIL PROTECTED]> writes: |> > |> > Now, I should like to improve this, but there are two problems. The |> > first is political, and is whether it would be acceptable in Python to |> > restore the semantics that were standard up until about 1980 in

Re: Using "external" vars on module load time

2006-06-14 Thread Diez B. Roggisch
Marco Aschwanden schrieb: > Marvelous that was the solution I was looking for. > >> I think you should consider a class instead of a module, though. > > What I don't get: Why should I consider using a class? Because sharing state in such a way that several functions need to access some later bo

Re: newbe: tuple

2006-06-14 Thread Tim Chase
> ip = socket.gethostbyaddr(socket.gethostname()) > > ip then becomes a tuple and takes on three values. I am trying to pull the > value of ip[2] which when printed displays: > ['10.5.100.17']. > > I want this ip that is being returned, but I would like it as a string, > without the [' and ']. An

Re: What is Expressiveness in a Computer Language

2006-06-14 Thread Raffael Cavallaro
On 2006-06-14 09:42:25 -0400, [EMAIL PROTECTED] (Torben Ægidius Mogensen) said: > It takes longer for the average > programmer to get the program working in the dynamically typed > language. Though I agree with much of your post I would say that many here find the opposite to be true - it takes

Unimporting modules, memory leak?

2006-06-14 Thread Antonio Arauzo Azofra
Hello everybody, Probably, this is being too demanding for Python, but it may be useful to unimport modules to work with dynamic code (though not the best, one example is [2]). In fact, it is supposed to be possible[1], but I have detected it usually leaks memory. When unimported in Linux, the si

Re: python-dev Summary for 2006-05-01 through 2006-05-15

2006-06-14 Thread Steven Bethard
[EMAIL PROTECTED] wrote: > This summary is tagged as being in ISO-8859-1 encoding: > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > However, it really is in UTF-8 Hmm... I guess Gmail's automatic encoding selection isn't working for the summaries. I've changed my Gmail settings

convert floats to their 4 byte representation

2006-06-14 Thread godavemon
I need to take floats and dump out their 4 byte hex representation. This is easy with ints with the built in hex function or even better for my purpose def hex( number, size ): s = "%"+str(size) + "X" return (s % number).replace(' ', '0') but I haven't been able to find anything f

Re: "groupby" is brilliant!

2006-06-14 Thread Alex Martelli
Frank Millman <[EMAIL PROTECTED]> wrote: > Benji York wrote: > > Frank Millman wrote: > > > reader = csv.reader(open('trans.csv', 'rb')) > > > rows = [] > > > for row in reader: > > > rows.append(row) > > > > Why do you create a list of rows instead of just iterating over the > > reader direct

Re: "groupby" is brilliant!

2006-06-14 Thread Alex Martelli
James Stroud <[EMAIL PROTECTED]> wrote: ... > def doit(rows, doers, i=0): >for r, alist in groupby(rows, itemgetter(i)): > if len(doers) > 1: >doit(alist, doers[1:], i+1) > doers[0](r) Isn't this making N useless slices (thus copies, for most kinds of sequences) for a doer

Re: numeric/numpy/numarray

2006-06-14 Thread Alex Martelli
Bryan <[EMAIL PROTECTED]> wrote: ... > so, was Numarray written *before* NumPY, or was it a reimplementation of > NumPy which implies it came *after* NumPy? it seems clear that Numeric is > the old one and i read is not being worked on anymore. so that leaves > Numarray and numpy. which of the

Re: Tiddlywiki type project in Python?

2006-06-14 Thread Diez B. Roggisch
> Well, that may be an/the answer, since another form of my question > would be 'how can I write a TiddlyWikiLike using Python instead of JS' > ;-). I appreciate that it might involve, for instance, a local server. > Does the idea of embedding python in a browser instead of Javascript > make any se

Re: What is Expressiveness in a Computer Language

2006-06-14 Thread Rob Thorpe
Torben Ægidius Mogensen wrote: > On a similar note, is a statically typed langauge more or less > expressive than a dynamically typed language? Some would say less, as > you can write programs in a dynamically typed language that you can't > compile in a statically typed language (without a lot of

prog1 | prog2 . How not to make prog2 block if not piped?

2006-06-14 Thread riquito
I googled around, but couldn't understand how to solve this problem. I have 2 scripts # script1.py # print 'something' #script2.py x=sys.stdin.read() print 'passed' if I run script1.py | script2.py all goes well. But if I run just script2.py the program blocks waiting forever for input. On *ni

Re: convert floats to their 4 byte representation

2006-06-14 Thread Alex Martelli
godavemon <[EMAIL PROTECTED]> wrote: > I need to take floats and dump out their 4 byte hex representation. > This is easy with ints with the built in hex function or even better > for my purpose > > def hex( number, size ): > s = "%"+str(size) + "X" > return (s % number).replace(' ',

Re: convert floats to their 4 byte representation

2006-06-14 Thread Tim Chase
> s = "%"+str(size) + "X" > return (s % number).replace(' ', '0') While I don't have a fast and easy way to represent floats, you may want to tweak this to be return ("%0*X" % (size,number)) which will zero-pad the number in hex to "size" number of places in a single step.

Re: cos: "Integer Required"?!?!?!?

2006-06-14 Thread moonman
It appears that the cause of this problem was indirect. I input something incorrect as an argument to an xplane sdk function and the cos/integer type error followed. Thanks for the help. The diagnostic functions I learned in this thread will be very helpful in the future. moonman wrote: > I'm u

Re: Numerics, NaNs, IEEE 754 and C99

2006-06-14 Thread Grant Edwards
On 2006-06-14, Nick Maclaren <[EMAIL PROTECTED]> wrote: >|>> Now, I should like to improve this, but there are two problems. The >|>> first is political, and is whether it would be acceptable in Python to >|>> restore the semantics that were standard up until about 1980 in the >|>> numerical prog

Re: convert floats to their 4 byte representation

2006-06-14 Thread Grant Edwards
On 2006-06-14, godavemon <[EMAIL PROTECTED]> wrote: > I need to take floats and dump out their 4 byte hex representation. struct -- Grant Edwards grante Yow! Darling, my ELBOW at is FLYING over FRANKFURT,

Re: Extending Python - Understanding Flags...

2006-06-14 Thread Alex Martelli
John Machin <[EMAIL PROTECTED]> wrote: ... > > If it is any consolation I hope to take what I learn and put together > > a tutorial on expanding Python for those that only have a little > > experience with C programming, like myself. I plan to explain > > everything like I was teaching a 6-year

Re: [OT] Re: Python open proxy honeypot

2006-06-14 Thread imcs ee
On 13 Jun 2006 15:09:57 -0700, Serge Orlov <[EMAIL PROTECTED]> wrote: > Alex Reinhart wrote: > My spam folder at gmail is not growing anymore for many months (it is > about 600-700 spams a month). Have spammers given up spamming gmail.com > only or is it global trend? Gmail said "messages that have

Re: prog1 | prog2 . How not to make prog2 block if not piped?

2006-06-14 Thread Maric Michaud
Le Mercredi 14 Juin 2006 17:13, [EMAIL PROTECTED] a écrit : > # script1.py # > print 'something' > > #script2.py > x=sys.stdin.read() read() will read a file object to the end, i guess you want to use readline() instead or the builtin raw_input. > print 'passed' > > if I run > script1.py | script

Re: convert floats to their 4 byte representation

2006-06-14 Thread Scott David Daniels
godavemon wrote: > I need to take floats and dump out their 4 byte hex representation. > This is easy with ints with the built in hex function or even better > for my purpose > > def hex( number, size ): > s = "%"+str(size) + "X" > return (s % number).replace(' ', '0') This should be

popen and password entry

2006-06-14 Thread sinan nalkaya
hello, i want to use rsync for remote file transfer via popen, but couldnt pass the Password yet. here`s what i did cmd = 'rsync -av config [EMAIL PROTECTED]:/tmp/.' f = os.popen(cmd,'w') f.write('1234') #not worked f.write('1234\n') #not worked every time i see "Password:" line, then i tried p

Re: Writing PNG with pure Python

2006-06-14 Thread Johann C. Rocholl
Ben Finney schrieb: > Simplify. Please don't attempt to write yet another set of license > terms without expert legal assistance. You've already chosen the Expat > license as being acceptable; use that, and you grant all the rest > without even mentioning it. Sorry for my stubborn ignorance, and t

Re: Bundling an application with third-party modules

2006-06-14 Thread Scott David Daniels
utabintarbo wrote: > A couple of alternatives: > 1. py2exe/csFreeze-type thing. This would even relieve the customer of > installing python > 2. An Installshield-type installer can place files (essentially) > wherever you want them > > HTH > Also, remember to credit those third-party packages; th

Re: Numerics, NaNs, IEEE 754 and C99

2006-06-14 Thread Christophe
Grant Edwards a écrit : > The division by zero trap is really annoying. In my world the > right thing to do is to return Inf. Your world is flawed then, this is a big mistake. NaN is the only aceptable return value for a division by zero. -- http://mail.python.org/mailman/listinfo/python-list

Re: convert floats to their 4 byte representation

2006-06-14 Thread godavemon
I've been a member for a while but I had no idea how helpful this form is. I had a one hour meeting and when I came back there were 4 replies. Thanks for your help! Scott David Daniels wrote: > godavemon wrote: > > I need to take floats and dump out their 4 byte hex representation. > > This is

Python Help

2006-06-14 Thread Kathy Garcia
To Whom it May Concern: I have recently downloaded Python 2.4.3 on Windows XP. The program does not recongnize when I type in python:" name 'python' is not defined". Please tell me how to correct this. Express yourself instantly with MSN Messenger! MSN Messenger Download today it's FREE! -- htt

Re: Numerics, NaNs, IEEE 754 and C99

2006-06-14 Thread Scott David Daniels
Grant Edwards wrote: > While you're at it, the pickle modules need to be fixed so they > support NaN and Inf. ;) The NaN problem is portability -- NaN values are not standard, and pretending they are won't help. There are many possible NaNs, several of which have desirable behaviors, and differen

Re: Numerics, NaNs, IEEE 754 and C99

2006-06-14 Thread Grant Edwards
On 2006-06-14, Christophe <[EMAIL PROTECTED]> wrote: > Grant Edwards a écrit : >> The division by zero trap is really annoying. In my world the >> right thing to do is to return Inf. > > Your world is flawed then, this is a big mistake. NaN is the > only aceptable return value for a division by ze

Re: Numerics, NaNs, IEEE 754 and C99

2006-06-14 Thread Grant Edwards
On 2006-06-14, Scott David Daniels <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: > >> While you're at it, the pickle modules need to be fixed so they >> support NaN and Inf. ;) > The NaN problem is portability -- NaN values are not standard, My copy of IEEE 754 defines them quite precisely. :

Re: Numerics, NaNs, IEEE 754 and C99

2006-06-14 Thread Gary Herron
Christophe wrote: > Grant Edwards a écrit : > >> The division by zero trap is really annoying. In my world the >> right thing to do is to return Inf. >> > > Your world is flawed then, this is a big mistake. NaN is the only > aceptable return value for a division by zero. > Sorry, but t

Re: Numerics, NaNs, IEEE 754 and C99

2006-06-14 Thread Christophe
Grant Edwards a écrit : > On 2006-06-14, Christophe <[EMAIL PROTECTED]> wrote: > >>Grant Edwards a écrit : >> >>>The division by zero trap is really annoying. In my world the >>>right thing to do is to return Inf. >> >>Your world is flawed then, this is a big mistake. NaN is the >>only aceptable

Re: Python Help

2006-06-14 Thread Tim Chase
> I have recently downloaded Python 2.4.3 on Windows XP. The > program does not recongnize when I type in python:" name > 'python' is not defined". Please tell me how to correct this. Sounds like you don't have it in your path. In XP, use Win+Break to pull up your system properties (the same as

Re: convert floats to their 4 byte representation

2006-06-14 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, godavemon <[EMAIL PROTECTED]> wrote: >I've been a member for a while but I had no idea how helpful this form >is. I had a one hour meeting and when I came back there were 4 >replies. Thanks for your help! > > >Scott David Daniels wrote: >> godavemon wrote: >> > I n

Re: wxpython: how do i write this without the id parameter?

2006-06-14 Thread Scott David Daniels
John Salerno wrote: > Scott David Daniels wrote: > >> class InputForm(wx.Frame): >> def __init__(self, parent=None, id=-1, title=__file__): > > Also, is there a way to define parent and id with defaults, but not > title? Is it good to change the order around to do this? No, too many things k

  1   2   >