Re: csv module and unicode, when or workaround?

2005-03-12 Thread Max M
Chris wrote: the current csv module cannot handle unicode the docs say, is there any workaround or is unicode support planned for the near future? in most cases support for characters in iso-8859-1(5) would be ok for my purposes but of course full unicode support would be great... It doesn't sup

Re: Licensing Python code under the Python license

2005-03-12 Thread Daniel Keep
Wow. That was fast. PHP forums eat your heart out :P Thanks for the advice. I'll probably go with either the BSD license, or possibly the LGPL. But I'm leaning towards the BSD since it fits on the screen... -- http://mail.python.org/mailman/listinfo/python-list

Re: a program to delete duplicate files

2005-03-12 Thread John Machin
David Eppstein wrote: > In article <[EMAIL PROTECTED]>, > Patrick Useldinger <[EMAIL PROTECTED]> wrote: > > > > Well, but the spec didn't say efficiency was the primary criterion, it > > > said minimizing the number of comparisons was. > > > > That's exactly what my program does. > > If you're do

Re: Widget geometry ?

2005-03-12 Thread PGMoscatt
Thanks Pierre all working now. Pete Pierre Quentel wrote: > PGMoscatt a Ãcrit : >> Hi All, >> >> I am trying to create a dialog which will have a number of components but >> having trouble with the placement of various widgets. >> >> For example, in my code below you will see I am trying

Re: csv module and unicode, when or workaround?

2005-03-12 Thread John Machin
Chris wrote: > hi, > to convert excel files via csv to xml or whatever I frequently use the > csv module which is really nice for quick scripts. problem are of course > non ascii characters like german umlauts, EURO currency symbol etc. The umlauted characters should not be a problem, they're all

Re: csv module and unicode, when or workaround?

2005-03-12 Thread Chris
hi, thanks for all replies, I try if I can at least get the work done. I guess my problem mainly was the rather mindflexing (at least for me) coding/decoding of strings... But I guess it would be really helpful to put the UnicodeReader/Writer in the docs thanks a lot chris -- http://mail.python

Passing values to another script using CGI

2005-03-12 Thread Mike Wimpe
Without creating a form, how do i pass a value to another script? I would like to pass: group = "Oranges" to another script or at least just 'group' and initialize it in the first script. script1: ''' group = "Oranges" ''' script2: print ''' Oh you like '''+group+'''.''' thanks, Mike --

Re: [NGG/98]-Medicationns

2005-03-12 Thread Hinrik Crocker
  Hello, Just Visit Our Pharrmacy-By-Mail SHOP and save up to 75%.   Va um Vi ra Ci is Am en,  And man li ag al bi y other!   P.S. You will be pleasantly surprised with our prrices ;)   Have a good day! -- http:/

How to send browser to open a different URL

2005-03-12 Thread Mike Wimpe
Sorry to go back to back so fast but how does one send a web browser to a different url than the one the user is already at? In script2 (which is doing the authenticating), if the user fails authentication i want to send him back to the one he was at before. thanks, Mike -- http://mail.python.o

Re: a program to delete duplicate files

2005-03-12 Thread Patrick Useldinger
John Machin wrote: Just look at the efficiency of processing N files of the same size S, where they differ after d bytes: [If they don't differ, d = S] PU: O(Nd) reading time, O(Nd) data comparison time [Actually (N-1)d which is important for small N and large d]. Hashing method: O(NS) reading time

[Ann] ctypes 0.9.5 released

2005-03-12 Thread Thomas Heller
ctypes 0.9.5 released - Mar 11, 2005 Overview ctypes is an advanced ffi (Foreign Function Interface) package for Python 2.3 and higher. ctypes allows to call functions exposed from dlls/shared libraries and has extensive facilities to create,

Re: Python 2.4, distutils, and pure python packages

2005-03-12 Thread "Martin v. Löwis"
Thomas Heller wrote: It would be for 2.5, anyway, and I have hoped that bdist_wininst would be replaced by bdist_msi then ;-). What are your plans for that? I still hope to write one by for 2.5. One issue is that you cannot have multiple installations of an MSI package. So if you want to support d

Re: [Python-Dev] RELEASED Python 2.4.1, release candidate 1

2005-03-12 Thread "Martin v. Löwis"
Vincent Wehren wrote: is there a reason why msiexec iterates through what looks like all (?) files and directories in/under the destination directory? There is massive file I/O going on there (OK, by now you know I didn't de-install 2.4 before trying ;-)) which explains the 100% CPU usage and th

Re: shuffle the lines of a large file

2005-03-12 Thread paul koelle
Joerg Schuster wrote: Thanks to all. This thread shows again that Python's best feature is comp.lang.python. from comp.lang import python ;) Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: i18n: looking for expertise

2005-03-12 Thread "Martin v. Löwis"
klappnase wrote: enc = locale.nl_langinfo(locale.CODESET).lower() Notice that this may fail on systems which don't provide the CODESET information. Recent Linux systems (glibc 6) have it, and so do recent Solaris systems, but if you happen to use an HPUX9 or some such, you find that locale.CODE

Re: About Databases...

2005-03-12 Thread EP
[EMAIL PROTECTED] wrote: > Hello NG, Hello! > >I am still quite a newbie with Python (I intensely use wxPython, > anyway). > I would like to know what are, in your opinions, the best/faster > databases > that I could use in Python (and, of course, I should be able to "link" > everything

Re: Adapting code to multiple platforms

2005-03-12 Thread Peter Hansen
Simon John wrote: If you're using a GUI, then that may help you decode the platform too - for example wxPython has wx.Platform, there's also platform.platform() , sys.platform and os.name You could try import win32api and checking for an exception ;-) (Winky noted) Just in case anyone thinks that

Re: Why does this not work?

2005-03-12 Thread Peter Hansen
Gensek wrote: (I don't know how to make the title more specific in a useful way, sorry.) Here's a hint: take a moment to look over your post just before you send it, and pick at least one of the specific details therein. In this case, "problem with PingGUI" would have been most helpful in (a) letti

Re: RELEASED Python 2.4.1, release candidate 1

2005-03-12 Thread Tim N. van der Leeuw
Hi Roger, Thanks, I understand it now, I didn't yet receive in the mail any replies to my post on py-dev when I read your post here! That's why it didn't make any sense to me. I didn't yet have a chance to try the workaround given in the bug-report (remove MBCS encoding line). Hope to find time s

Re: Safe Local XMLRPC

2005-03-12 Thread Diez B. Roggisch
> I've used the default support available by these classes. Thus it will > run on a potentially public TCP/IP port. As the application backend > allows, among other things, saving files to the local filesystem, this > would be a clear security hole in the wild. Restricting it to > localhost would b

head for grouped data - looking for best practice

2005-03-12 Thread Harald Massa
Old, very old informatical problem: I want to "print" grouped data with head information, that is: eingabe=[ ("Stuttgart","70197","Fernsehturm","20"), ("Stuttgart","70197","Brotmuseum","123"), ("Stuttgart","70197","Porsche","123123"), ("Leipzig","01491","Messe","91822"), ("Leipzig","01491","Scha

Re: newbie: dictionary - howto get key value

2005-03-12 Thread Peter Hansen
John Machin wrote: G. Völkl wrote: I use a dictionary: phone = {'mike':10,'sue':8,'john':3} Of course in the real world using given name as a unique key is ludicrous: 'mike' is a.k.a. 'michael' (or 'mikhail' or 'michele' (which may be a typo for 'michelle')), and if there's only one 'sue' in your l

Re: Adapting code to multiple platforms

2005-03-12 Thread Patrick Useldinger
Jeffrey Barish wrote: I have a small program that I would like to run on multiple platforms (at least linux and windows). My program calls helper programs that are different depending on the platform. I think I figured out a way to structure my program, but I'm wondering whether my solution is go

Re: How to send browser to open a different URL

2005-03-12 Thread Harald Massa
"Mike Wimpe" <[EMAIL PROTECTED]> wrote in news:1110628448.532469.117000 @g14g2000cwa.googlegroups.com: http://groups.google.de/groups?hl=de&lr=&c2coff=1&threadm= 2c60a528.0309251324.109d4af5%40posting.google.com&rnum=5&prev=/groups%3Fq% 3Dhttp%2520redirect%2520header%2520python%26hl%3Dde%26lr%3D%2

Re: head for grouped data - looking for best practice

2005-03-12 Thread Diez B. Roggisch
> which indeed leeds to the expected result, while looking less "hacky" .. > on the other hand side, that "getdoublekey" ist not very flexible; when > doing the same with 3 Columns forming the head information, I have to > define the next function... Make getdoublekey something like this (untested

is there a problem on this simple code

2005-03-12 Thread jrlen balane
basically what the code does is transmit data to a hardware and then receive data that the hardware will transmit. import serial import string import time from struct import * ser = serial.Serial() ser.baudrate = 9600 ser.port = 0 ser ser.close() ser.open() command = 67 message_no = 1 total_da

Re: How to turn a variable name into a string?

2005-03-12 Thread Scott David Daniels
André Roberge wrote: [EMAIL PROTECTED] wrote: I have a number of variables (environmental variables, actually), most of which will have a value. But some may not have been found by os.environ.get(), so I set those to None. Now, if any of them are None, the app cannot proceed, so I want to test for

bsddb support for berkeley db 4.3?

2005-03-12 Thread janeaustine50
It doesn't seem like the python 2.4(and the recent 2.4.1) support berkeley db 4.3. (4.3 fixes some deadlock bugs I occasionally encounter using 4.2.) bsddb3(at pybsddb.sf.net) already supports 4.3 since last December(but doesn't explicitly support win32 -- see the assert statement in setup.py). I

Re: pre-PEP: Print Without Intervening Space

2005-03-12 Thread Marcin Ciura
Steve Holden wrote: You could think about teaching them the linelist.append(fn(x)) way, which then gives you the choice of "".join(linelist) - no gaps "\n".join(lienlist) - one item per line " ".join(linelist) - spaces between items. Sure I will. Next week, when we come to list operations. .

Newbie question Tkinter bitmap

2005-03-12 Thread Wim Goffin
Hi,   I'm trying to get a bitmap onto a button, but I can't.Can anyone tell me where to look for a solution?   The call I use is this one:self.b = Button(toolbar, text="nieuw", bitmap="@/test.xbm", width=20, command=self.print_msg)   The message I get is this:Traceback (most recent call last

Python Tkinter Newbie question

2005-03-12 Thread Wim Goffin
Hi,   I'm trying to get a bitmap onto a button, but I can't.Can anyone tell me where to look for a solution?   The call I use is this one:self.b = Button(toolbar, text="nieuw", bitmap="@/test.xbm", width=20, command=self.print_msg)   The message I get is this:Traceback (most recent call last

Tkinter Bitmap Newbie question

2005-03-12 Thread Wim Goffin
Hi,   I'm trying to get a bitmap onto a button, but I can't.Can anyone tell me where to look for a solution?   The call I use is this one:self.b = Button(toolbar, text="nieuw", bitmap="@/test.xbm", width=20, command=self.print_msg)   The message I get is this:Traceback (most recent call last

Re: About Databases...

2005-03-12 Thread Lee Harr
On 2005-03-11, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello NG, > >I am still quite a newbie with Python (I intensely use wxPython, anyway). > I would like to know what are, in your opinions, the best/faster databases > that I could use in Python (and, of course, I should be able to "li

Re: a program to delete duplicate files

2005-03-12 Thread Scott David Daniels
Patrick Useldinger wrote: Just to explain why I appear to be a lawer: everybody I spoke to about this program told me to use hashes, but nobody has been able to explain why. I found myself 2 possible reasons: 1) it's easier to program: you don't compare several files in parallel, but process on

Re: Confused with classmethods

2005-03-12 Thread Jong dejongconsunet
jfj schreef: Ruud wrote: So far for *how* it works. As to *why* it works like this, I don't know for sure. But my guess is that the reasoning was something as follows: if you define a function (regular or something special like a classmethod) only for an instance of a class, you obviously don't wan

Re: pre-PEP: Print Without Intervening Space

2005-03-12 Thread huy
Marcin Ciura wrote: Duncan Booth wrote: import sys def nospace(value, stream=None): '''Suppress output of space before printing value''' stream = stream or sys.stdout stream.softspace = 0 return str(value) I'm teaching Python as the first programming language to non-computer scient

Re: psycopg authentication

2005-03-12 Thread Lee Harr
On 2005-03-12, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello, I'm new to both PostgreSQL and psycopg and I'm trying to connect > to my database running on localhost. I have postgres setup to do md5 > authentication and this works when using a db admin tool on my local > network. For some rea

Re: head for grouped data - looking for best practice

2005-03-12 Thread Peter Otten
Harald Massa wrote: > def getdoublekey(row): > return row[0:2] > > for key, bereich in groupby(eingabe,getdoublekey): > print "Area:",key > for data in bereich: > print "--data--", data[2:] > > which indeed leeds to the expected result, while looking less "hacky" .. > on the

Re: Tkinter Bitmap Newbie question

2005-03-12 Thread Diez B. Roggisch
Posting the same question three times is unecessary and is likely to upset people! > TclError: error reading bitmap file "\test.xbm" This is no valid path name - nor is "@/test.xbm", at least to my knowledge. What happens if you supply the full path like this: path = "C:\\somedir\\test.xbm" --

Re: How to send browser to open a different URL

2005-03-12 Thread Mike Wimpe
although a bit more than I bargained for, this does has some good info, in case you are way in the future of this post... love, mike -- http://mail.python.org/mailman/listinfo/python-list

[ANN] XPN 0.4.5 released

2005-03-12 Thread Nemesis
XPN - X Python Newsreader is a multiplatform newsreader with unicode support. It is written in Python+PyGTK. It has features like scoring/actions, XFace and Face decoding and random taglines. You can find it on: http://xpn.altervista.org/index-en.html http://sf.net/projects/xpn Changes in this

Re: Licensing Python code under the Python license

2005-03-12 Thread Ville Vainio
> "Daniel" == Daniel Keep <[EMAIL PROTECTED]> writes: Daniel> Thanks for the advice. I'll probably go with either the Daniel> BSD license, or possibly the LGPL. But I'm leaning Daniel> towards the BSD since it fits on the screen... Isn't MIT license even shorter and simpler? A w

Re: a program to delete duplicate files

2005-03-12 Thread Patrick Useldinger
Scott David Daniels wrote: comparisons. Using hashes, three file reads and three comparisons of hash values. Without hashes, six file reads; you must read both files to do a file comparison, so three comparisons is six files. That's provided you compare always 2 files at a time. I compar

Re: Wishlist item: itertools.flatten

2005-03-12 Thread Ville Vainio
> "Michael" == Michael Spencer <[EMAIL PROTECTED]> writes: Michael> Here's a non-recursive implementation. Thanks. Michael> There are lots around. Yet another fact that suggest the inclusion in stdlib would make sense ;-). -- Ville Vainio http://tinyurl.com/2prnb -- http://m

Re: Python Tkinter Newbie question

2005-03-12 Thread Harlin Seritt
You have: ="@/test.xbm" take the '/' out or (if it is in a different dir which i think it is), do ="/@test.xbm" also... make sure your *.xbm is really a bitmap file (that would just be another thing to check... not to say its not the proper format)... Regards, Harlin Seritt -- http://mail.

Re: Licensing Python code under the Python license

2005-03-12 Thread Harlin Seritt
If this is for making money, make it either a proprietary license or BSD. If you're giving it away and expect nothing for it except maybe fame, do GPL. :-) Regards, Harlin Seritt -- http://mail.python.org/mailman/listinfo/python-list

Re: Licensing Python code under the Python license

2005-03-12 Thread Harlin Seritt
When you ask an opinion, you can expect a long thread list... even if it's something inane like "What kind of license should I use?"... hacker/geeks/freaks/wannabes are only too happy to issue an opinion -- warranted or otherwise... Regards, Harlin Seritt -- http://mail.python.org/mailman/listi

Re: Python Tkinter Newbie question

2005-03-12 Thread Harlin Seritt
Try not to triple post if you can help it (I'll assume you accidentally hit the SENT button three times ) Regards, Harlin Seritt -- http://mail.python.org/mailman/listinfo/python-list

Re: is there a problem on this simple code

2005-03-12 Thread Harlin Seritt
hah, this code is anything but simple... -- http://mail.python.org/mailman/listinfo/python-list

Re: a program to delete duplicate files

2005-03-12 Thread François Pinard
[Patrick Useldinger] > Shouldn't you add the additional comparison time that has to be done > after hash calculation? Hashes do not give 100% guarantee. If there's > a large number of identical hashes, you'd still need to read all of > these files to make sure. Identical hashes for different file

PythonWin

2005-03-12 Thread tkpmep
I have a Python program that collects user input using msg = "Enter the full path and name of the file to be processed: " answer = raw_input(msg) If I run it in IDLE, the question is splashed across the execution window, and if it is long, simply wraps to the next line. Most importantly, it is in

Re: a RegEx puzzle (end of thread)

2005-03-12 Thread Charles Hartman
Won't extend this except to say thanks to Michael Spencer for another version. If I were doing it only once I'd use that. Since I do it more than once I should package it as a function. Thanks. Charles Hartman Professor of English, Poet in Residence http://cherry.conncoll.edu/cohar http://villex

Re: Licensing Python code under the Python license

2005-03-12 Thread "Martin v. Löwis"
Ville Vainio wrote: Daniel> Thanks for the advice. I'll probably go with either the Daniel> BSD license, or possibly the LGPL. But I'm leaning Daniel> towards the BSD since it fits on the screen... Isn't MIT license even shorter and simpler? A while ago some Debian guys were speculati

Debugging Python Scripts inside other processes

2005-03-12 Thread A. Klingenstein
I embedded Python in a Windows C++ program. Now I want to debug my embedded scripts which of course won't run in any IDE process. Commercial IDEs like WingIDE can attach to external processes by importing a module in the scripts. Is there a debugger capable of this which is Free or Open Source?

Re: PEP 309 (Partial Function Application) Idea

2005-03-12 Thread Scott David Daniels
Reinhold Birkenfeld wrote: Steven Bethard wrote: Chris Perkins wrote: Random idea of the day: How about having syntax support for currying/partial function application, like this: func(..., a, b) func(a, ..., b) func(a, b, ...) That is: 1) Make an Ellipsis literal legal syntax in an argument list.

Re: a program to delete duplicate files

2005-03-12 Thread Patrick Useldinger
François Pinard wrote: Identical hashes for different files? The probability of this happening should be extremely small, or else, your hash function is not a good one. We're talking about md5, sha1 or similar. They are all known not to be 100% perfect. I agree it's a rare case, but still, why se

Re: head for grouped data - looking for best practice

2005-03-12 Thread Steven Bethard
Harald Massa wrote: def getdoublekey(row): return row[0:2] for key, bereich in groupby(eingabe,getdoublekey): print "Area:",key for data in bereich: print "--data--", data[2:] Why don't you just pass a slice to itemgetter? py> eingabe=[ ... ("Stuttgart","70197","Fernsehturm","20

Re: Safe Local XMLRPC

2005-03-12 Thread Michael Urman
[Sorry, I previously replied to Diez offlist, and probably to a spam-protected address at that. Here's that reply and my followup after reading up on pyro ] On Sat, 12 Mar 2005 11:08:31 -0600, Michael Urman <[EMAIL PROTECTED]> wrote: > On Sat, 12 Mar 2005 14:12:21 +0100, Diez B. Roggisch <[EMAIL PR

Generating data types automatically

2005-03-12 Thread Torsten Bronger
HallÃchen! I have to generate a lot of data types (for ctypes by the way). An example is ViUInt32 = u_long ViPUInt32 = POINTER(ViUInt32) ViAUInt32 = ViPUInt32 Therefore, I defined functions that should make my life easier: def generate_type_dublett(visa_type, ctypes_type): visa_type_name

Add Properties to Instances?

2005-03-12 Thread Martin Miller
I'm trying to create some read-only instance specific properties, but the following attempt didn't work: > class Foobar(object): > pass > > foobar = Foobar() > foobar.x = property(fget=lambda: 42) > > print "foobar.x:", foobar.x Which results in the following ouput instead of '42': foobar.x

Re: Generating data types automatically

2005-03-12 Thread Torsten Bronger
HallÃchen! Torsten Bronger <[EMAIL PROTECTED]> writes: > I have to generate a lot of data types (for ctypes by the way). > An example is > > ViUInt32 = u_long > ViPUInt32 = POINTER(ViUInt32) > ViAUInt32 = ViPUInt32 > > Therefore, I defined functions that should make my life easier: > > [...] > >

Re: Add Properties to Instances?

2005-03-12 Thread Steven Bethard
Martin Miller wrote: I'm trying to create some read-only instance specific properties, but the following attempt didn't work: class Foobar(object): pass foobar = Foobar() foobar.x = property(fget=lambda: 42) print "foobar.x:", foobar.x [snip] Can anyone tell me what's wrong with this approach

Re: Debugging Python Scripts inside other processes

2005-03-12 Thread Robin Becker
A. Klingenstein wrote: I embedded Python in a Windows C++ program. Now I want to debug my embedded scripts which of course won't run in any IDE process. Commercial IDEs like WingIDE can attach to external processes by importing a module in the scripts. Is there a debugger capable of this which

Can't seem to insert rows into a MySQL table

2005-03-12 Thread grumfish
I'm trying to add a row to a MySQL table using insert. Here is the code: connection = MySQLdb.connect(host="localhost", user="root", passwd="pw", db="japanese") cursor = connection.cursor() cursor.execute("INSERT INTO edict (kanji, kana, meaning) VALUES (%s, %s, %s)", ("a", "b", "c") ) connection

Re: Generating data types automatically

2005-03-12 Thread Michael Hoffman
Torsten Bronger wrote: def generate_type_dublett(visa_type, ctypes_type): visa_type_name = visa_type.__name__ exec visa_type_name + "=" + ctypes_type.__name__ exec "ViP" + visa_type_name[2:] + "=POINTER(" + visa_type_name + ")" You shouldn't need to use exec for this, and it is best to

Re: bsddb support for berkeley db 4.3?

2005-03-12 Thread "Martin v. Löwis"
[EMAIL PROTECTED] wrote: It doesn't seem like the python 2.4(and the recent 2.4.1) support berkeley db 4.3. What makes you say that? It builds fine for me. bsddb3(at pybsddb.sf.net) already supports 4.3 since last December(but doesn't explicitly support win32 -- see the assert statement in setup.p

Re: Generating data types automatically

2005-03-12 Thread Steven Bethard
Torsten Bronger wrote: Okay this works: def generate_type_dublett(visa_type, ctypes_type): return visa_type + "=" + ctypes_type + ";" + \ "ViP" + visa_type[2:] + "=POINTER(" + visa_type + ")" def generate_type_triplett(visa_type, ctypes_type): return generate_type_dublett(visa_type,

Re: Can't seem to insert rows into a MySQL table

2005-03-12 Thread Patrick Useldinger
grumfish wrote: connection = MySQLdb.connect(host="localhost", user="root", passwd="pw", db="japanese") cursor = connection.cursor() cursor.execute("INSERT INTO edict (kanji, kana, meaning) VALUES (%s, %s, %s)", ("a", "b", "c") ) connection.close() Just a guess "in the dark" (I don't use MySQL):

Re: Add Properties to Instances?

2005-03-12 Thread Jeremy Bowers
On Sat, 12 Mar 2005 09:48:42 -0800, Martin Miller wrote: > I'm trying to create some read-only instance specific properties, but the > following attempt didn't work: I'm going to echo Steven's comment: "What's the situation in which you think you want different properties for different instances

Re: confusion around CustomException example in 'Python in a Nutshell'

2005-03-12 Thread erick_bodine
Peter Hansen wrote: > [EMAIL PROTECTED] wrote: > > In Martinelli's Nutshell book in the Exceptions chapter there is an > > example of a custom exception class (pg.112) that I am trying to > > implement without success. The custom exception class example pulls > > sys.exc_info() into an attribute

Building Python 2.4 with icc and processor-specific optimizations

2005-03-12 Thread Michael Hoffman
Just out of curiosity, I was wondering if anyone has compiled Python 2.4 with the Intel C Compiler and its processor specific optimizations. I can build it fine with OPT="-O3" or OPT="-xN" but when I try to combine them I get this as soon as ./python is run: """ case $MAKEFLAGS in \ *-s*) CC='icc

Re: Debugging Python Scripts inside other processes

2005-03-12 Thread A. Klingenstein
Robin Becker wrote: A. Klingenstein wrote: I embedded Python in a Windows C++ program. Now I want to debug my embedded scripts which of course won't run in any IDE process. Commercial IDEs like WingIDE can attach to external processes by importing a module in the scripts. Is there a debugger cap

Re: Wishlist item: itertools.flatten

2005-03-12 Thread gene . tani
window / cons / fencepost / slice functions: +1 (with a flag to say if you want to truncate or pad incomplete tuples at end of input sequence. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303279 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303060 http://aspn.activestate.com/

Re: Safe Local XMLRPC

2005-03-12 Thread Michael Urman
Thanks for your time everyone; I got it XMLRPC working over unix domain stream sockets. In case people are interested, here's the pieces I put together. I'm sure they throw away a little flexibility, but they work for my purpose. Any pointers to make the code more robust, or do less total overridin

SimpleXMLServer meets inetd

2005-03-12 Thread Marek Kubica
Hi! I was thinking about connecting SimpleXMLRPCServer with inetd.. but I haven't been able to replace the socket by sys.stdin and sys.stdout. Maybe socket.fromfd(sys.stdin.fileno()) could help me, but I can't get it to work, I always get connection refused. Any ideas? greets, Marek -- http://m

Re: Can't seem to insert rows into a MySQL table

2005-03-12 Thread Stephen Prinster
grumfish wrote: The rowcount of the cursor is 1 after the execute is 1 and the table's auto_increment value is increased for each insert done. If the auto_increment is increased, then it seems like the row was inserted. Are you sure the problem is not with your SELECT attempt? Just a guess, b

Re: PEP 309 (Partial Function Application) Idea

2005-03-12 Thread Chris Perkins
>Scott David Daniels wrote: >>>Chris Perkins wrote: Random idea of the day: How about having syntax support for currying/partial function application, like this: func(..., a, b) func(a, ..., b) func(a, b, ...) That is: 1) Make an Ellipsis literal legal syntax in an

Re: Can't seem to insert rows into a MySQL table

2005-03-12 Thread deelan
grumfish wrote: I'm trying to add a row to a MySQL table using insert. Here is the code: connection = MySQLdb.connect(host="localhost", user="root", passwd="pw", db="japanese") cursor = connection.cursor() cursor.execute("INSERT INTO edict (kanji, kana, meaning) VALUES (%s, %s, %s)", ("a", "b", "

Thank you. New question concerning text encoding

2005-03-12 Thread grumfish
Patrick Useldinger wrote: Just a guess "in the dark" (I don't use MySQL): is "commit" implicit, or do you have to add it yourself? Thank you. Inserts work fine now. Another question. I'm trying to insert Japanese text into the table. I created the database using 'CHARACTER SET UTF8'. In Python I

Re: Can't seem to insert rows into a MySQL table

2005-03-12 Thread deelan
deelan wrote: which version of MySQLdb are you running? versions 1.1.6 and below gained a connection.autocommit) method set by default ehm, 1.1.6 and *above*, of course. :) -- "Però è bello sapere che, di questi tempi spietati, almeno un mistero sopravvive: l'età di Afef Jnifen." -- dagospia.com -

Re: Safe Local XMLRPC

2005-03-12 Thread Diez B. Roggisch
> Hmm. On inspection, pyro seems to be really heavy, what with its > requirement of a pyro-nameserver, and using TCP as the transport. The nameserver is purely optional. Regarding the overhead of transport - well, I didn't check pyro on that, but corba is 10-100 times faster over the network than

Installation Guide

2005-03-12 Thread Online Support
Hello,   I'm in critical need to install Python Imaging Library on my linux/cpanel server. I'm not very experienced and I almost always have to use instalation guides. I have downloaded the software, unzipped it, and now I think I just need to install it somehow. Are there files that need to be

wishlist item: itertools.partition (WAS: Wishlist item: itertools.flatten)

2005-03-12 Thread Steven Bethard
[EMAIL PROTECTED] wrote: > window / cons / fencepost / slice functions: +1 > > (with a flag to say if you want to truncate or pad incomplete tuples > at end of input sequence. > > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303279 > http://aspn.activestate.com/ASPN/Cookbook/Python/Recip

Re: pre-PEP: Print Without Intervening Space

2005-03-12 Thread Marcin Ciura
Bengt Richter wrote: BTW, what makes you think any self-respecting "scientist" wouldn't be insulted by the idea of your spoon-feeding them a dumbed-down programming equivalent of "See Spot run"? Am I right thinking that your dream 3 R's curriculum starts with "Stately, plump Buck Mulligan" and Póly

blocking a program until a non-Python process terminates

2005-03-12 Thread Earl Eiland
I'm running an .exe in Python, using subProcess.Popen. The executable writes data to a file I process later on in the program. Unfortunately, my program returns the error "no such file...". How do I block execution until the external executable terminates? Earl -- http://mail.python.org/mailm

Re: Why does this not work?

2005-03-12 Thread Gensek
PingGUI is a program that nobody but me knows anything about. If I wanted help from people who are experts on it, I'd get nothing at all. -- http://mail.python.org/mailman/listinfo/python-list

Re: Installation Guide

2005-03-12 Thread Skip Montanaro
Kevin> I'm in critical need to install Python Imaging Library on my Kevin> linux/cpanel server. I'm not very experienced and I almost always Kevin> have to use instalation guides. Take a look at the BUILDME and README files in the top-level directory. Skip -- http://mail.python.org/

Re: Add Properties to Instances?

2005-03-12 Thread Martin Miller
So far a couple of people have asked: > What's the situation in which you think you want different properties > for different instances of the same class? Fair enough -- here goes: Essentially what I'm doing is implementing (yes, yet another ;-) 'enumeration' class using an an approach which invo

Re: PEP 309 (Partial Function Application) Idea

2005-03-12 Thread Steven Bethard
Chris Perkins wrote: [snip implementation] While I think that func(x, ...) is more readable than partial(func, x), I'm not sure that I would use either of them often enough to warrant special syntax. Interesting. Thought it might be worth listing a few of the current places people use lambdas (an

Re: Safe Local XMLRPC

2005-03-12 Thread Stephen Waterbury
Diez B. Roggisch wrote: ... corba is 10-100 times faster over the network than soap/xmlrpc. ... I'm not challenging these statistics (because I don't know), but I would be interested in the source. Are you referring to the results of an actual benchmark, or something more subjective? Steve -- http

dinamically altering a function

2005-03-12 Thread vegetax
I i need a decorator that adds a local variable in the function it decorates, probably related with nested scopes, for example: def dec(func): def wrapper(obj = None): if not obj : obj = Obj() return func() return wrapper() @dec() def fun(b): obj.desc = 'marked' obj.

Re: newbie: dictionary - howto get key value

2005-03-12 Thread Bengt Richter
On Thu, 10 Mar 2005 18:56:41 +0100, bruno modulix <[EMAIL PROTECTED]> wrote: >G. Völkl wrote: >> Hello, >> >> I use a dictionary: >> >> phone = {'mike':10,'sue':8,'john':3} >> >> phone['mike'] --> 10 >> >> I want to know who has number 3? >> 3 --> 'john' > >Note that you can have many keys

error sending path to Win OS

2005-03-12 Thread Earl Eiland
os.path.getsize(Inputdirectory + '\\' + Filename) works, but os.path.getsize(Inputdirectory + '\\' + Filename.split('.') + '.ext') Fails reporting "no such file or directory InputDirectory\\Filename.ext". os.path.getsize(Inputdirectory + r'\' + Filename.split('.') + '.ext') generates a syntax error

Re: a program to delete duplicate files

2005-03-12 Thread John Machin
Patrick Useldinger wrote: > John Machin wrote: > > > Just look at the efficiency of processing N files of the same size S, > > where they differ after d bytes: [If they don't differ, d = S] > > > > PU: O(Nd) reading time, O(Nd) data comparison time [Actually (N-1)d > > which is important for small

Re: head for grouped data - looking for best practice

2005-03-12 Thread Harald Massa
Steve, > Why don't you just pass a slice to itemgetter? py> for key, bereich in groupby(eingabe, itemgetter(slice(0, 2))): WHOW, that is great! that makes it really simple, just have to structure the SQL to make a real "cut first, serve first" structure. Thanks to all who helped! also the "f

Re: a program to delete duplicate files

2005-03-12 Thread Patrick Useldinger
John Machin wrote: Maybe I was wrong: lawyers are noted for irritating precision. You meant to say in your own defence: "If there are *any* number (n >= 2) of identical hashes, you'd still need to *RE*-read and *compare* ...". Right, that is what I meant. 2. As others have explained, with a decent

Re: dinamically altering a function

2005-03-12 Thread Steven Bethard
vegetax wrote: I i need a decorator that adds a local variable in the function it decorates, probably related with nested scopes, for example: def dec(func): def wrapper(obj = None): if not obj : obj = Obj() return func() return wrapper() @dec() def fun(b): obj.desc = 'marke

Re: is there a problem on this simple code

2005-03-12 Thread jrlen balane
@sir harlin so you are saying that there is nothing wrong in this simple program. On 12 Mar 2005 07:39:31 -0800, Harlin Seritt <[EMAIL PROTECTED]> wrote: > hah, this code is anything but simple... > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/l

Re: blocking a program until a non-Python process terminates

2005-03-12 Thread Michael Hoffman
Earl Eiland wrote: I'm running an .exe in Python, using subProcess.Popen. The executable writes data to a file I process later on in the program. Unfortunately, my program returns the error "no such file...". How do I block execution until the external executable terminates? Either: 1) returncod

Re: dinamically altering a function

2005-03-12 Thread vegetax
Steven Bethard wrote: > vegetax wrote: >> I i need a decorator that adds a local variable in the function it >> decorates, probably related with nested scopes, for example: >> >> def dec(func): >> def wrapper(obj = None): >> if not obj : obj = Obj() >> >> return func() >> >>

  1   2   >