GOZERBOT 0.8 BETA released
gozerbot 0.8 is coming real soon in a chat channel near you and thus we have made a BETA of the upcoming 0.8 release available. new in 0.8: * third party addons for plugins * ipv6 udp * reboot without disconnects * owneruserhost is now a list * lots of bug fixes please test gozerbot 0.8 BETA and let us know how its working out. download the beta at http://gozerbot.org mercurial repository is at http://core.gozerbot.org/~bart/releases/0.8-BETA bug reports can be reported at http://dev.gozerbot.org or channel #dunkbots on IRCnet and Freenode ABOUT GOZERBOT: Requirements * a shell * python 2.4 or higher * if you want to remotely install plugins: the gnupg module * if you want mysql support: the py-MySQLdb module * if you want jabber support: the xmpppy module Why gozerbot? * provide both IRC and Jabber support * user management by userhost .. bot will not respond if it doesn't know you (see /docs/USER/) * fleet .. use more than one bot in a program (list of bots) (see / docs/FLEET/) * use the bot through dcc chat * fetch rss feeds (see /docs/RSS/) * remember items * relaying between bots (see /docs/RELAY/) * program your own plugins (see /docs/PROGRAMPLUGIN/) * run the builtin webserver (see /docs/WEBSERVER/) * query other bots webserver via irc (see /docs/COLLECTIVE/) * serve as a udp - irc or jabber gateway (see /docs/UDP) * mysql and sqlite support the gozerbot development team -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html
Re: IronPython vs CPython: faster in 1.6 times?
Stefan Behnel: This doesn't look like Mono to me: IronPython 1.1 (1.1) on .NET 2.0.50727.42 You are right! I think this shows that IronPython isn't faster than CPython at all :-) (And it uses more memory). Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list
Re: What is the most simple, quicket, yet most powerful python Web-Framework?
xkenneth a écrit : All, I'm trying to build a simple web application, but i still need things like sessions and Ajax. I tried to create a Zope product, but I honestly can't think of anything more cryptic. Indeed !-) I really don't enjoy learning all of the magic code and debugging an environment I have to study to know the slightest thing about. I'm looking for simple, fast, and easy. I'm both a manager and a developer, so I don't have a lot of time to try things out and see what fits best. I need a solution i can implement well and with a great deal of speed. My project is going to be rather simple, just some simple forms for setup/configuration, user management, I assume I'll need templates, Then I'd recommand Django: clean, easy to get started with yet still powerful, well documented, strong community. You'll also get some basic user management and simple yet very usable and useful automatic admin forms for free. I'd like to use Ajax or a similar technology to display orthogonal and polar graphs that automatically update. This is mostly orthogonal to the framework. For the DB backend I'm planning on using ZODB. ZODB is actually quite amazing, and after using it, I honestly can't think of a reason for using a SQL database. Having working experience with both the ZODB and various SQL DBMS, I can think of quite a lot of pretty good reasons to use a SQL database, and quite a lot of good reasons to avoid the ZODB unless you pretty well know what you're doing. Don't get me wrong: the ZODB is a pretty good piece of software, and there are some use case for it. But since you're talking about orthogonal and polar graphs - which to me implies lot of small, atomic, highly structured data -, I don't think an OODB would fit here. -- http://mail.python.org/mailman/listinfo/python-list
Re: polling for output from a subprocess module
Ivo [EMAIL PROTECTED] wrote: Thomas Bellman wrote: However, the os.read() function will only read what is currently available. Note, though, that os.read() does not do line-based I/O, so depending on the timing you can get incomplete lines, or multiple lines in one read. be carefull that you specify how much you want to read at a time, otherwise it cat be that you keep on reading. Specify read(1024) or somesuch. Well, of course you need to specify how much you want to read. Otherwise os.read() throws an exception: import sys, os os.read(sys.stdin.fileno()) Traceback (most recent call last): File stdin, line 1, in module TypeError: read() takes exactly 2 arguments (1 given) In case of my PPCEncoder I recompiled the mencoder subprocess to deliver me lines that end with \n. If anyone can tell me how to read a continues stream than I am really interested. I have never had any problem when using the os.read() function, as long as I understand the effects of output buffering in the subprocess. The file.read() method is a quite different animal. (And then there's the problem of getting mplayer/mencoder to output any *useful* information, but that is out of the scope of this newsgroup. :-) -- Thomas Bellman, Lysator Computer Club, Linköping University, Sweden God is real, but Jesus is an integer. ! bellman @ lysator.liu.se ! Make Love -- Nicht Wahr! -- http://mail.python.org/mailman/listinfo/python-list
Re: package import
Sean Allen wrote: ok, what am i doing wrong? in current working directory i have: t.py sub/t1.py t.py is: import sub.t1 i get: ImportError: No module named sub.t1 t.py is import sub i get: ImportError: No module named sub.t1 -- i am obviously missing something really basic here. have tried on multiple machines, linux and mac os x. http://docs.python.org/tut/node8.html#SECTION00840 Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: Show Image with WebKit
Gabriel, I already tried In ower list in Argentina... I reveived a lot of answers of people who wants to help me, but we can't find the solution to my problem, because of that I'm asking here. Anyway, thank's to try to aproach me to ower community in PyAr. Ah, the thread is Guardar y recuperar imagen desde Postgres. That was my first problem, and then it become to the one that I'm trying to solve now. Thanks a lot, Marcos Alcazar -- http://mail.python.org/mailman/listinfo/python-list
Re: Running files with the associated program...
On Feb 6, 6:09 am, Gabriel Genellina [EMAIL PROTECTED] wrote: En Tue, 05 Feb 2008 22:34:59 -0200, E-Lo [EMAIL PROTECTED] escribió: How can I start a file (on Windows) with the associated program, http://docs.python.org/lib/os-process.html#l2h-2760 startfile(path[, operation]) Start a file with its associated application. When operation is not specified or 'open', this acts like double-clicking the file in Windows Explorer, or giving the file name as an argument to the start command from the interactive command shell: the file is opened with whatever application (if any) its extension is associated. -- Gabriel Genellina thanks, it worked :) -- http://mail.python.org/mailman/listinfo/python-list
Re: breaking out of outer loops
On 2008-01-29, Jeremy Sanders [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Any elegant way of breaking out of the outer for loop than below, I seem to have come across something, but it escapes me for i in outerLoop: for j in innerLoop: if condition: break else: continue break Perhaps Python needs a continue N or a break N statement :-) for i in outerLoop: for j in innerLoop: if condition: break 2 Just fake it with an exception class LoopBreaker(Exception): pass try: for i in outerLoop: for j in innerLoop: if condition: raise LoopBreaker except LoopBreaker: pass -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Retreiving objects from other processes
Hello, Sorry if this is a stupid question... I have some experience with C but very little with Python. I'd like to have one python program retrieve a reference or copy of an object from another python process on the same computer. I know I can use RPyC, but that seems like overkill. Is there simpler way of doing it? Thanks in advance, Natan -- http://mail.python.org/mailman/listinfo/python-list
Re: Retreiving objects from other processes
Natan Yellin wrote: Hello, Sorry if this is a stupid question... I have some experience with C but very little with Python. I'd like to have one python program retrieve a reference or copy of an object from another python process on the same computer. I know I can use RPyC, but that seems like overkill. Is there simpler way of doing it? I don't know RPyC, but Pyro seems what you need/use. It's really simple to use. But RPC without a bit of boilerplate isn't possible, so you will need a dozen lines of code or so. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: boolean decisions
[EMAIL PROTECTED] wrote: Statestep (which includes Python code generation) might be something to look at. It's designed to help the user create simplified rules to begin with rather than derive them post hoc (it's really for much bigger problems where enumerating individual rules like you've done would be impractical) ... However, if you start with an exploded set of atomic rules like you now have, you could create simplified rules yourself, progressively deleting the rules you are replacing (identified as overlaps by Statestep); this way, at least the tool is checking the correctness of the transformation from individual to simplified rules (if you make a mistake then a conflict will be reported rather than an overlap). Michael All of this has been useful, but I over estimated the people I work with. having reduced the problem to only 4 input variables. They carefully produced a spreadsheet with 20 scenarios. There were clearly 4 scenarios missing, but also 4 pairs of duplicates in the input space; worse only one of the duplicate pairs agreed on the action. sigh -impossibly yrs- Robin Becker -- http://mail.python.org/mailman/listinfo/python-list
Need Smart Phone with new features? please click here
www.enmac.com.hk GSM Mobile Phones, Digital iPods, Digital Clocks, Digital Pens, Digital Quran. Enjoy these products with Islamic Features (Complete Holy Quran with Text and Audio, Tafaseer books, Ahadees Books, Daily Supplications, Universal Qibla Direction, Prayer Timing and much more) visit our website for more information. -- http://mail.python.org/mailman/listinfo/python-list
TheSchwartz in Python?
Hi, I'm looking for a job queue manager in Python, like TheSchwartz.[1]. I found there's TheSchawrtz server, RPC server powered by Gearman, to which Python/Ruby can connect [2], but setting up two languages env is a little cumbersome to me. Is there any alternative to that in Python? The requirement is * Store job queue in disk, not memory * Easy to set up * 100% Python Any pointers would be appliciated. Thanks. [1] http://search.cpan.org/~bradfitz/TheSchwartz-1.04/lib/TheSchwartz.pm [2] http://brad.livejournal.com/2332359.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Why chdir command doesn't work with client.get_transport() ?
Internet [EMAIL PROTECTED] To python-list Sent by: cc python-list-bounces+matthew.warren=uk.bnpparibas.com@ python.org Subject Re: Why chdir command doesn't work with 05/02/2008 19:39 client.get_transport() ? Thank you, Matt, for your valuable advice! I did try using ';' to issue three commands at once and it works! However, I have more problems with issuing ClearCase commands, which is what I am really doing. Under telnet, I could issue commands one by one, just as typing at the command prompt. Now I tried to use ';' manually typing two commands at once on my Solaris command line, such as ct setview viewName; cd dir_in_clearcase (ct = cleartool) The second command will not be executed, since the command prompt changes after the first command. --- I think that it was because there was a long delay after the first command. (any way out?) I'm not familiar with cleartool - could it be that the first command you are using is invoking an application that is not returning to the command line?, for example, if you were telnetted in and doing the same would you literally type $ct setview viewName $cd /some/where or does the session look more like $ct setview viewName _new_ct_prompt exit $cd /some/where If that is the case, it mightbe possible to direct ct to get it's input from a file ct setview viewName exitfile; cd /some/where and exitfile has the word 'exit' in it. just an idea though. may not work. When I used exec_command() to do this in Python, even the first command was not recognized (error: bad phone number. I used 'man ct' and found that ct dials a phone number). Even if 'ct' was recognized, the second command would not be executed. And it is useless to do it in the next exec_command() function. (Without the first command, one can not cd into a directory in ClearCase.) I'm a bit confused here. - Do you have an application called 'ct' (from previous paragraph, it appears you do. But if you are issuing 'ct' via python and getting 'bad phone number'??) Can you explain the bigger picture a bit more, and what ClearCase is? Why do you say 'Even if ct was recognized, the second command would not be executed' - if ct was recognised and returns to the command line prompt I would fully expect the second command to execute. Do you think that paramiko can replace telnet in my application? Thanks. I think it would be taking it a bit far if you are just trying to automate something unless you really have to run on a remote machine. Then either telnet or paramiko should work. You could also maybe look at using python to invoke rsh/rexec processes if telnet was suitable in the first place. Matt This message and any attachments (the message) is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. The internet can not guarantee the integrity of this message. BNP PARIBAS (and its subsidiaries) shall (will) not therefore be liable for the message if modified. Do not print this message unless
Re: Why chdir command doesn't work with client.get_transport() ?
|--- | Internet | | [EMAIL PROTECTED]| | | | | | Sent by: | | python-list-bounces+matthew.warren=uk.bnpparibas.com@| | python.org | | | | 06/02/2008 06:32 | |--- -| | | | | | To| | python-list | | cc| | | | Subject| | Re: Why chdir command doesn't work with client.get_transport() ? | | | | | | | | | | | | | -| When I used exec_command() to do this in Python, even the first command was not recognized (error: bad phone number. I used 'man ct' and found that ct dials a phone number). Even if 'ct' was recognized, the second command would Which basically demonstrated that the shell started from Python didn't run the same initialization as your login G... Somewhere you have a symbol definition for ct to cleartool. ahh. thats cleared up that bit of confusion for me, anyways :) Matt. This message and any attachments (the message) is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. The internet can not guarantee the integrity of this message. BNP PARIBAS (and its subsidiaries) shall (will) not therefore be liable for the message if modified. Do not print this message unless it is necessary, consider the environment. - Ce message et toutes les pieces jointes (ci-apres le message) sont etablis a l'intention exclusive de ses destinataires et sont confidentiels. Si vous recevez ce message par erreur, merci de le detruire et d'en avertir immediatement l'expediteur. Toute utilisation de ce message non conforme a sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. L'internet ne permettant pas d'assurer l'integrite de ce message, BNP PARIBAS (et ses filiales) decline(nt) toute responsabilite au titre de ce message, dans l'hypothese ou il aurait ete modifie. N'imprimez ce message que si necessaire, pensez a l'environnement. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why chdir command doesn't work with client.get_transport() ?
I try not to top-post in this group, but the strange formatting of the message makes this advisable, as I am sure many people won't even persist in reading down as far as the content. Can I make a wild-assed guess that you are a Lotus Notes user reading python-list? Please try and find a way of not barfing these awful headers out with your post (perhaps you could use a newsgroup reader and access the gmane servers?). It really does make it difficult to focus on what you say when there are twenty-odd lines of badly-formatted heading information at the start of each message. regards Steve [EMAIL PROTECTED] wrote: Internet [EMAIL PROTECTED] To python-list Sent by: cc python-list-bounces+matthew.warren=uk.bnpparibas.com@ python.org Subject Re: Why chdir command doesn't work with 05/02/2008 19:39 client.get_transport() ? Thank you, Matt, for your valuable advice! I did try using ';' to issue three commands at once and it works! However, I have more problems with issuing ClearCase commands, which is what I am really doing. Under telnet, I could issue commands one by one, just as typing at the command prompt. Now I tried to use ';' manually typing two commands at once on my Solaris command line, such as ct setview viewName; cd dir_in_clearcase (ct = cleartool) The second command will not be executed, since the command prompt changes after the first command. --- I think that it was because there was a long delay after the first command. (any way out?) I'm not familiar with cleartool - could it be that the first command you are using is invoking an application that is not returning to the command line?, for example, if you were telnetted in and doing the same would you literally type $ct setview viewName $cd /some/where or does the session look more like $ct setview viewName _new_ct_prompt exit $cd /some/where If that is the case, it mightbe possible to direct ct to get it's input from a file ct setview viewName exitfile; cd /some/where and exitfile has the word 'exit' in it. just an idea though. may not work. When I used exec_command() to do this in Python, even the first command was not recognized (error: bad phone number. I used 'man ct' and found that ct dials a phone number). Even if 'ct' was recognized, the second command would not be executed. And it is useless to do it in the next exec_command() function. (Without the first command, one can not cd into a directory in ClearCase.) I'm a bit confused here. - Do you have an application called 'ct' (from previous paragraph, it appears you do. But if you are issuing 'ct' via python and getting 'bad phone number'??) Can you explain the bigger picture a bit more, and what ClearCase is? Why do you say 'Even if ct was recognized, the second command would not be executed' - if ct was recognised and returns to the command line prompt I would fully expect the second command to execute. Do you think that paramiko can replace telnet in my application? Thanks. I think it would be taking it a bit far if you are just trying to automate something unless you really have to run on a
Re: Why chdir command doesn't work with client.get_transport() ?
I try not to top-post in this group, but the strange formatting of the message makes this advisable, as I am sure many people won't even persist in reading down as far as the content. Can I make a wild-assed guess that you are a Lotus Notes user reading python-list? Please try and find a way of not barfing these awful headers out with your post (perhaps you could use a newsgroup reader and access the gmane servers?). It really does make it difficult to focus on what you say when there are twenty-odd lines of badly-formatted heading information at the start of each message. regards Steve What amuses me (honestly, it does make me chuckle) is people can put up with a bunch of text like that as a reply on the list (and including previous disclaimers, which I've been slapped-wrist on here for before now), yet complain about a bit of odd formatting at the top of a message with real content. However I do understand where your coming from. You are right, I'm a Lotus Notes user. If I didn't have to use it I wouldn't. If I had access to the list from where I currently work any other way I would use that. I am aware people dont enjoy spurious details like disclaimers and Note's headers in emails. I forgot to remove the Notes header at the top for that last post, I do apologise for any inconvenience. I did remove the previous disclaimers though, so you only got two that time. Ohwell, everyone makes mistakes :) Thanks, Matt. (Apologies for the disclaimers etc...) This message and any attachments (the message) is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. The internet can not guarantee the integrity of this message. BNP PARIBAS (and its subsidiaries) shall (will) not therefore be liable for the message if modified. Do not print this message unless it is necessary, consider the environment. - Ce message et toutes les pieces jointes (ci-apres le message) sont etablis a l'intention exclusive de ses destinataires et sont confidentiels. Si vous recevez ce message par erreur, merci de le detruire et d'en avertir immediatement l'expediteur. Toute utilisation de ce message non conforme a sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. L'internet ne permettant pas d'assurer l'integrite de ce message, BNP PARIBAS (et ses filiales) decline(nt) toute responsabilite au titre de ce message, dans l'hypothese ou il aurait ete modifie. N'imprimez ce message que si necessaire, pensez a l'environnement. -- http://mail.python.org/mailman/listinfo/python-list
Re: Data Manipulation - Rows to Columns
This is smells of homework. Here are few alternative solutions of mine that I don't like. I presume a good teacher will refuse them all, because no one of them uses the right tool :-) And every one of them has some small problem (even if they work here). data = \ itemTABLE/table colorblack/color colorblue/color colorred/color itemCHAIR/table coloryellow/color colorblack/color colorred/color itemSOFA/table colorwhite/color colorgray/color colorpink/color data2 = data.replace(color,).replace(/color,).replace(/ table,) groups = [b.split() for b in data2.split(item) if b] print groups print import re data2 = re.sub(rcolor|/color|/table, , data) groups = [b.split() for b in data2.split(item) if b] print groups print import re def splitter(data): patt = re.compile(r(?:item(.*)/table)|(?:color(.*)/ color)) parts = [] for mo in patt.finditer(data): p1, p2 = mo.groups() if p1 is None: parts.append(p2) else: if parts: yield parts parts = [p1] if parts: yield parts print list(splitter(data)) print def splitter2(items, predicate): parts = [] for el in items: if predicate(el): parts.append(el) else: if parts: yield parts parts = [el] if parts: yield parts import re patt = re.compile(r(?:item(.*)/table)|(?:color(.*)/color)) xmobjects = (mo.groups() for mo in patt.finditer(data)) process = lambda group: [group[0][0]] + [part[1] for part in group[1:]] isstart = lambda (p1,p2): p1 is None xgroups = (process(g) for g in splitter2(xmobjects, isstart)) print list(xgroups) print data2 = itemTABLE/table colorblack/color colorblue / color colorred/color itemCHAIR/table coloryellow/color colorblack/color colorred/color itemSOFA/table colorwhite/color colorgray/color color pink / color import re patt = re.compile(r \s* \s* (item|color) \s* \s* (.*) \s* \s* / \s* (?:table|color) \s* \s* , re.VERBOSE) groups = [] for mo in patt.finditer(data2): p1, p2 = mo.groups() if p1 == item: groups.append([p2]) else: groups[-1].append(p2) print groups print Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list
Re: Must COMMIT after SELECT (was: Very weird behavior in MySQLdb execute)
On Tuesday 05 February 2008 18:58:49 John Nagle wrote: So you really do have to COMMIT after a SELECT, if you are reusing the database connection. CGI programs usually don't have this issue, because their connections don't live long, but long-running FCGI (and maybe Twisted) programs do. I've experienced the same thing for long-running tasks even when using different connections/cursors against the same db for db queries and log writing dbhandlers respectively. Whenever I did a SELECT() on the first connection, the cursor would stop seeing new entries commited in the log table by the other connection. I always assumed you needed COMMIT() after adding new content to the database, not after every single query, but this perhaps indicate otherwise? Regards, Frank -- http://mail.python.org/mailman/listinfo/python-list
Re: Why chdir command doesn't work with client.get_transport() ?
[EMAIL PROTECTED] wrote: I try not to top-post in this group, but the strange formatting of the message makes this advisable, as I am sure many people won't even persist in reading down as far as the content. Can I make a wild-assed guess that you are a Lotus Notes user reading python-list? Please try and find a way of not barfing these awful headers out with your post (perhaps you could use a newsgroup reader and access the gmane servers?). It really does make it difficult to focus on what you say when there are twenty-odd lines of badly-formatted heading information at the start of each message. regards Steve What amuses me (honestly, it does make me chuckle) is people can put up with a bunch of text like that as a reply on the list (and including previous disclaimers, which I've been slapped-wrist on here for before now), yet complain about a bit of odd formatting at the top of a message with real content. However I do understand where your coming from. You are right, I'm a Lotus Notes user. If I didn't have to use it I wouldn't. If I had access to the list from where I currently work any other way I would use that. I am aware people dont enjoy spurious details like disclaimers and Note's headers in emails. I forgot to remove the Notes header at the top for that last post, I do apologise for any inconvenience. I did remove the previous disclaimers though, so you only got two that time. Ohwell, everyone makes mistakes :) Thanks, Matt. (Apologies for the disclaimers etc...) Yeah, well, some things we can't help. Like I can't help being a crotchety old bastard sometimes. Sorry, and thanks for the explanation. I realise there is no chance your mail admins will remove the useless disclaimer, but could you ask them to put a -- line above it? That way us folks with mailers that at least attempt standards-compliance don't have to delete it from our replies (or, even worse, forget to, and leave multiple copies in - yes, we do all make mistakes, and sadly I'm no exception). I did at least forbear from writing back pointing out I wasn't the intended recipient, etc., etc. :-) Anyway, glad you got a pointer to the solution from Dennis. curmudgeon-ly y'rs - steve -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Why chdir command doesn't work with client.get_transport() ?
[EMAIL PROTECTED] writes: However I do understand where your coming from. You are right, I'm a Lotus Notes user. If I didn't have to use it I wouldn't. If I had access to the list from where I currently work any other way I would use that. Have you tried www.gmane.org? -- http://mail.python.org/mailman/listinfo/python-list
RE: Multiple interpreters retaining huge amounts of memory
What objects need to be shared across interpreters? My thought was to add an interpreter number to the PyThreadState structure, to increment it when Py_NewInterpreter is called, and to keep track of the interpreter that creates each object. On deletion, all memory belonging to these objects would be freed. Thoughts? -Original Message- From: Martin v. Löwis [mailto:[EMAIL PROTECTED] Sent: Friday, February 01, 2008 8:34 PM To: python-list@python.org Subject: Re: Multiple interpreters retaining huge amounts of memory Is there some way to track references per interpreter, or to get the memory allocator to set up seperate arenas per interpreter so that it can remove all allocated memory when the interpreter exits? No. The multi-interpreter feature doesn't really work, so you are basically on your own. If you find out what the problem is, please submit patches to bugs.python.org. In any case, the strategy you propose (with multiple arenas) would *not* work, since some objects have to be shared across interpreters. Regards, Martin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This message is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice. IRS Circular 230 Disclosure: Please be advised that any discussion of U.S. tax matters contained within this communication (including any attachments) is not intended or written to be used and cannot be used for the purpose of (i) avoiding U.S. tax related penalties or (ii) promoting, marketing or recommending to another party any transaction or matter addressed herein. -- http://mail.python.org/mailman/listinfo/python-list
RE: Why not a Python compiler?
-Original Message- From: [EMAIL PROTECTED] [mailto:python- [EMAIL PROTECTED] On Behalf Of Luis M. González Sent: Tuesday, February 05, 2008 6:44 PM To: python-list@python.org Subject: Re: Why not a Python compiler? Pypy is a very ambitious project and it aims, amongst many other goals, to provide a fast just-in-time python implementation. They even say that the secret goal is being faster than c, which is nonsense, isn´t it? (I still didn´t get the joke though...). 'c' is also the speed of light. And since nothing can travel faster than light... One demerit has been marked against your geek card for missing an obvious science pun. Additionally, your membership to the Star Trek Lifestyle Adventure Club has been put on probationary status for the next twelve parsecs. * The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers. GA621 -- http://mail.python.org/mailman/listinfo/python-list
Re: Must COMMIT after SELECT (was: Very weird behavior in MySQLdb execute)
On 6 Feb, 16:04, Frank Aune [EMAIL PROTECTED] wrote: Whenever I did a SELECT() on the first connection, the cursor would stop seeing new entries commited in the log table by the other connection. I always assumed you needed COMMIT() after adding new content to the database, not after every single query, but this perhaps indicate otherwise? No, you just need to be aware that the database module has probably started a transaction on your behalf and that, as John points out, for certain database systems in certain configurations, any repetition of the same query in the same transaction will produce the same results, thus avoiding the nonrepeatable read problem. Really, the rule is this: always (where the circumstances described above apply) make sure that you terminate a transaction before attempting to read committed, updated data. If you religiously perform a COMMIT (or ROLLBACK) after every query, you'll just create lots of transactions for no good reason. Paul -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter fonts setting
On Tuesday 05 February 2008 15:22, Unnamed One wrote: First question - is it possible to set font to default OS font for window text? It would be preferable, while on my Windows XP system Tkinter sets small Helvetica-style font by default. Secondly, can I set font globally (or specify default font for widgets)? In fact, all I want is to get default OS font unless (rarely) I need to specify another. Thanks Go to: http://www.pythonware.com/library/tkinter/introduction/ Read chapter 6, Widget Styling, there is a section on Fonts which has a sub-section on System Fonts. jim-on-linux http://www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Why not a Python compiler?
On 2008-02-06, Reedick, Andrew [EMAIL PROTECTED] wrote: Pypy is a very ambitious project and it aims, amongst many other goals, to provide a fast just-in-time python implementation. They even say that the secret goal is being faster than c, which is nonsense, isn´t it? (I still didn´t get the joke though...). 'c' is also the speed of light. 'c' is the speed of light _in_a_vacuum_. And since nothing can travel faster than light... Nothing can travel faster than the speed of light _in_a_vacuum_. There are situtaitons where things can (and regularly do) travel faster than light: http://en.wikipedia.org/wiki/Cherenkov_radiation Half a demerit. One demerit has been marked against your geek card for missing an obvious science pun. Additionally, your membership to the Star Trek Lifestyle Adventure Club has been put on probationary status for the next twelve parsecs. Ouch. Two demerits for using the distance unit parsec in a context where a quantity of time was required. -- Grant Edwards grante Yow! Boys, you have ALL at been selected to LEAVE th' visi.comPLANET in 15 minutes!! -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter fonts setting
jim-on-linux wrote: On Tuesday 05 February 2008 15:22, Unnamed One wrote: First question - is it possible to set font to default OS font for window text? It would be preferable, while on my Windows XP system Tkinter sets small Helvetica-style font by default. Secondly, can I set font globally (or specify default font for widgets)? In fact, all I want is to get default OS font unless (rarely) I need to specify another. Thanks Go to: http://www.pythonware.com/library/tkinter/introduction/ Read chapter 6, Widget Styling, there is a section on Fonts which has a sub-section on System Fonts. jim-on-linux http://www.inqvista.com These are fonts supported by individual systems, but not fonts set there as default. Regarding my questions, I guess both are impossible in Tkinter (as I didn't found anything about that in any Tkinter documentation), but there still must be a way to get the default OS font name and size (maybe outside of Tkinter), because it's always advised to use them in applications. Otherwise text, for example, will always be too large or too small on some screens. -- http://mail.python.org/mailman/listinfo/python-list
RE: Why not a Python compiler?
-Original Message- From: [EMAIL PROTECTED] [mailto:python- [EMAIL PROTECTED] On Behalf Of Grant Edwards Sent: Wednesday, February 06, 2008 10:35 AM To: python-list@python.org Subject: Re: Why not a Python compiler? On 2008-02-06, Reedick, Andrew [EMAIL PROTECTED] wrote: Pypy is a very ambitious project and it aims, amongst many other goals, to provide a fast just-in-time python implementation. They even say that the secret goal is being faster than c, which is nonsense, isn´t it? (I still didn´t get the joke though...). 'c' is also the speed of light. 'c' is the speed of light _in_a_vacuum_. True. And since nothing can travel faster than light... Nothing can travel faster than the speed of light _in_a_vacuum_. There are situtaitons where things can (and regularly do) travel faster than light: http://en.wikipedia.org/wiki/Cherenkov_radiation Nope. It propagates, not travels, faster than light. Go ask a physicist to explain it. It's odd... One demerit has been marked against your geek card for missing an obvious science pun. Additionally, your membership to the Star Trek Lifestyle Adventure Club has been put on probationary status for the next twelve parsecs. Ouch. Two demerits for using the distance unit parsec in a context where a quantity of time was required. Ten demerits for not catching the Star Wars Kessel Run reference. -- http://mail.python.org/mailman/listinfo/python-list
Re: Traversing python datatypes via http
Mark wrote: Is it possible to traverse say python lists via http:// say there is a list in the memory can we traverse the list using list/next list/prev list/first list/last is there a pythonic library to do that? thanks It sounds like what you want would be implemented using XMLRPC over http (or https). You could have XMLRPC method that acted like a generator or you could have it return the entire list in a single transaction to the calling routine. To be more specific, you will need to go into more detail about what it is that you are trying to accomplish. -Larry -- http://mail.python.org/mailman/listinfo/python-list
Re: TheSchwartz in Python?
js wrote: Hi, I'm looking for a job queue manager in Python, like TheSchwartz.[1]. I found there's TheSchawrtz server, RPC server powered by Gearman, to which Python/Ruby can connect [2], but setting up two languages env is a little cumbersome to me. Is there any alternative to that in Python? The requirement is * Store job queue in disk, not memory * Easy to set up * 100% Python Any pointers would be appliciated. Thanks. [1] http://search.cpan.org/~bradfitz/TheSchwartz-1.04/lib/TheSchwartz.pm [2] http://brad.livejournal.com/2332359.html Are you sure CRON won't do the job for you. If not, then you may want to at least take a look at Python's sched module (if you haven't already). -Larry -- http://mail.python.org/mailman/listinfo/python-list
Re: TheSchwartz in Python?
Larry Bates wrote: js wrote: Hi, I'm looking for a job queue manager in Python, like TheSchwartz.[1]. I found there's TheSchawrtz server, RPC server powered by Gearman, to which Python/Ruby can connect [2], but setting up two languages env is a little cumbersome to me. Is there any alternative to that in Python? The requirement is * Store job queue in disk, not memory * Easy to set up * 100% Python Any pointers would be appliciated. Thanks. [1] http://search.cpan.org/~bradfitz/TheSchwartz-1.04/lib/TheSchwartz.pm [2] http://brad.livejournal.com/2332359.html Are you sure CRON won't do the job for you. If not, then you may want to at least take a look at Python's sched module (if you haven't already). I'd have though that at or batch would be more likely to be useful, as the OP makes no mention of regularly -scheduled tasks. regards Steve -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Why not a Python compiler?
Reedick, Andrew wrote: -Original Message- From: [EMAIL PROTECTED] [mailto:python- [EMAIL PROTECTED] On Behalf Of Grant Edwards Sent: Wednesday, February 06, 2008 10:35 AM To: python-list@python.org Subject: Re: Why not a Python compiler? On 2008-02-06, Reedick, Andrew [EMAIL PROTECTED] wrote: Pypy is a very ambitious project and it aims, amongst many other goals, to provide a fast just-in-time python implementation. They even say that the secret goal is being faster than c, which is nonsense, isn´t it? (I still didn´t get the joke though...). 'c' is also the speed of light. 'c' is the speed of light _in_a_vacuum_. True. And since nothing can travel faster than light... Nothing can travel faster than the speed of light _in_a_vacuum_. There are situtaitons where things can (and regularly do) travel faster than light: http://en.wikipedia.org/wiki/Cherenkov_radiation Nope. It propagates, not travels, faster than light. Go ask a physicist to explain it. It's odd... One demerit has been marked against your geek card for missing an obvious science pun. Additionally, your membership to the Star Trek Lifestyle Adventure Club has been put on probationary status for the next twelve parsecs. Ouch. Two demerits for using the distance unit parsec in a context where a quantity of time was required. Ten demerits for not catching the Star Wars Kessel Run reference. OK, now you can all take ten house points for getting into a jargon pissing contest. regards Steve -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Why not a Python compiler?
Reedick, Andrew wrote: -Original Message- From: [EMAIL PROTECTED] [mailto:python- [EMAIL PROTECTED] On Behalf Of Luis M. González Sent: Tuesday, February 05, 2008 6:44 PM To: python-list@python.org Subject: Re: Why not a Python compiler? Pypy is a very ambitious project and it aims, amongst many other goals, to provide a fast just-in-time python implementation. They even say that the secret goal is being faster than c, which is nonsense, isn´t it? (I still didn´t get the joke though...). 'c' is also the speed of light. And since nothing can travel faster than light... nice theory, but wrong: The PyPy home page uses a capital letter C: http://codespeak.net/pypy/dist/pypy/doc/home.html Cheers, Carl Friedrich Bolz -- http://mail.python.org/mailman/listinfo/python-list
Formatting arrays using myarrayy.tolist()
I've got an array that looks like this: p.xv[20:25] array([[ 1.60783821e-01, 1.04174046e+01, -1.74045566e-03, 6.02421398e-01, 2.16078382e+00, -1.60783821e-02], [ 1.66704816e-01, 1.04390422e+01, -1.90421758e-03, 5.81767402e-01, 2.16670482e+00, -1.66704816e-02], [ 1.72418976e-01, 1.04607380e+01, -2.07379715e-03, 5.61054649e-01, 2.17241898e+00, -1.72418976e-02], [ 1.77925722e-01, 1.04824899e+01, -2.24898715e-03, 5.40285230e-01, 2.17792572e+00, -1.77925722e-02], [ 1.83224500e-01, 1.05042958e+01, -2.42957975e-03, 5.19461244e-01, 2.18322450e+00, -1.83224500e-02]]) I want to dump it to a plain text file. The problem is, it unravels the array. The text file will look like this p.xv.tofile('file','\n') 10.3528613872 -0.00128613872188 0.664009998909 2.14178590964 -0.0141785909637 0.148323738585 10.3743121062 -0.0014312106189 and so on. i want it to look like this: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 any help would be appreciated. thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why not a Python compiler?
Hi Carl, Well, lets suppose that being faster than C is the real goal... Are you confident that it will be reached? How far is it at this moment? I've been following the project but the scarcity of news is getting me anxious... Cheers, Luis On Feb 6, 2008 2:14 PM, Carl Friedrich Bolz [EMAIL PROTECTED] wrote: Reedick, Andrew wrote: -Original Message- From: [EMAIL PROTECTED] [mailto:python- [EMAIL PROTECTED] On Behalf Of Luis M. González Sent: Tuesday, February 05, 2008 6:44 PM To: python-list@python.org Subject: Re: Why not a Python compiler? Pypy is a very ambitious project and it aims, amongst many other goals, to provide a fast just-in-time python implementation. They even say that the secret goal is being faster than c, which is nonsense, isn´t it? (I still didn´t get the joke though...). 'c' is also the speed of light. And since nothing can travel faster than light... nice theory, but wrong: The PyPy home page uses a capital letter C: http://codespeak.net/pypy/dist/pypy/doc/home.html Cheers, Carl Friedrich Bolz -- Luis M. González Tel/fax: (54-11) 4711-6783 celular: 15-5177-0650 -- http://mail.python.org/mailman/listinfo/python-list
Server side cookie problems
Hi, I am trying to set a cookie on a client computer using the Cookie module however all I get is the text being printed in the browser window. Can anyone point me in the right direction so that the cookie data is set without it appearing in the browser? A shortened version of the code is below, in the full version there is also userID check, this seems to work ok. I have removed that portion for the time being as its the writing part that is the problem. import sys, os, string, cgi, Cookie, urllib2 from types import ListType cookie = Cookie.SimpleCookie() cookieHdr = os.environ.get(HTTP_COOKIE, ) cookie.load(cookieHdr) def writetocookie(number): #writes the ID of the database entry to a cookie cookie[dataid]=number print Content-Type: text/html print print Set-Cookie: dataid=,cookie[dataid].value writetocookie(1) I presume this is not the correct way to write a cookie, the examples I have found online don't seem to provide much more information. Kind regards, rod -- http://mail.python.org/mailman/listinfo/python-list
Re: smtpd module
En Wed, 06 Feb 2008 05:36:05 -0200, Stefan Witzel [EMAIL PROTECTED] escribi�: the documentation of the smtpd module in the Python Library Reference is very short, I think. Are there any examples available? Especially I'm interested in the DebuggingServer. Yes, the documentation is rather incomplete. SMTPServer is an abstract class; it accepts local connections and handles them, but doesn't know what to do with the received message. Subclasses must override the process_message method to do something useful. DebuggingServer is the simplest subclass; it just prints the received message and nothing more, the message isn't delivered at all. Useful when you want to test some program that sends messages but you don't want them to be actually delivered. PureProxy delivers the message to the upstream SMTP server (defined in the constructor). By example: localsmtpd = smtpd.PureProxy(('localhost',2500),('smtp.whatever.com',25)) asyncore.loop() Then you (or your MUA, or any program, or a python script using smtplib) can connect locally to port 2500 and send messages; they will be delivered to smtp.whatever.com. You can subclass PureProxy and pre-process the message before it is sent; you could block some addresses, disallow attachments, add those annoying disclaimers... MailmanProxy, by example, is a PureProxy subclass that intercepts messages addressed to mailman and processes them directly. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Installing PyQt
Hi I was trying to install PyQt, but things don't work as promised. I'm working on OS X 10.5, didn't install another version of Python - so it's 2.5.1 -, installed the latest qt-mac-opensource-4.3.3.dmg and the latest sip 4.7.3. But when I then try to run python configure.py for PyQt 4.3.3 I get Import Error: No module named sipconfig (I also retried after a Reboot) Did anybody have the same problem and can tell me what solved it?? -- http://mail.python.org/mailman/listinfo/python-list
Re: Why chdir command doesn't work with client.get_transport() ?
En Wed, 06 Feb 2008 12:39:55 -0200, [EMAIL PROTECTED] escribió: If I had access to the list from where I currently work any other way I would use that. Have you Web access? You can read *and* post messages using: Google Groups http://groups.google.com/group/comp.lang.python/ Gmane http://news.gmane.org/gmane.comp.python.general -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: Installing PyQt
Marcus Strube schrieb: Hi I was trying to install PyQt, but things don't work as promised. I'm working on OS X 10.5, didn't install another version of Python - so it's 2.5.1 -, installed the latest qt-mac-opensource-4.3.3.dmg and the latest sip 4.7.3. But when I then try to run python configure.py for PyQt 4.3.3 I get Import Error: No module named sipconfig (I also retried after a Reboot) Did anybody have the same problem and can tell me what solved it?? Just a suggestion- does the DMG really install into your custom 2.5 installation? I'd gather it rather uses the pre-shipped python. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: Why not a Python compiler?
Hi Luis, Luis M. Gonzalez wrote: Well, lets suppose that being faster than C is the real goal... How about we call it a very long-term dream? Are you confident that it will be reached? We have ideas how to get there, but it is really rather long-term. There will be a lot of research needed to achieve that for sure. How far is it at this moment? Since a year already we have a JIT that makes quite fast code for purely integer-type operations. Quite fast meaning about the speed of gcc -O0. So far it is not faster than Psyco (it supports generators, though). We are confident that the JIT will get substantially better this year (probably better than Psyco). Where exactly this will leave us we don't know. I've been following the project but the scarcity of news is getting me anxious... Read the blog: morepypy.blogspot.com :-) Cheers, Carl Friedrich -- http://mail.python.org/mailman/listinfo/python-list
Re: Paramiko SFTP autologon using id_dsa.pub
I wrote a lil module using paramiko's module to send a file via sftp.. it works great using the username and password. I would prefer to use id_dsa.pub to have an autologon and not save the password anywhere on the disk.. I cant find a good example of this. Can anyone help ? When you have an ssh-agent running that has the key loaded, paramiko will automatically use that. If you don't have an ssh-agent running, you have to pass either the pkey or the key_filename argument; the former should be a PKey object (either RSAKey or DSSKey). Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: Installing PyQt
On Wednesday 06 February 2008, Marcus Strube wrote: Hi I was trying to install PyQt, but things don't work as promised. I'm working on OS X 10.5, didn't install another version of Python - so it's 2.5.1 -, installed the latest qt-mac-opensource-4.3.3.dmg and the latest sip 4.7.3. But when I then try to run python configure.py for PyQt 4.3.3 I get Import Error: No module named sipconfig (I also retried after a Reboot) Did anybody have the same problem and can tell me what solved it?? The current SIP snapshot handles 10.5's different Python directory structure. There will be a new release in the next few days. The Qt .dmg has a separate problem - building from source seems to solve it. Phil -- http://mail.python.org/mailman/listinfo/python-list
Re: IronPython vs CPython: faster in 1.6 times?
On Feb 5, 11:47 am, Stefan Behnel [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] schrieb: Mike C. Fletcher: Not sure if Mono also provides a speedup. There is a set of good benchmarks here, the answer is negative: http://shootout.alioth.debian.org/sandbox/benchmark.php?test=alllang... This doesn't look like Mono to me: IronPython 1.1 (1.1) on .NET 2.0.50727.42 Stefan Have you actually looked at the version string from IronPython-1.1- Bin.zip running on Mono? -- http://mail.python.org/mailman/listinfo/python-list
Re: IronPython vs CPython: faster in 1.6 times?
On Feb 6, 12:04 am, [EMAIL PROTECTED] wrote: Stefan Behnel: This doesn't look like Mono to me: IronPython 1.1 (1.1) on .NET 2.0.50727.42 You are right! No. I think this shows that IronPython isn't faster than CPython at all :-) (And it uses more memory). -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter fonts setting
En Wed, 06 Feb 2008 14:02:35 -0200, Unnamed One [EMAIL PROTECTED] escribi�: jim-on-linux wrote: On Tuesday 05 February 2008 15:22, Unnamed One wrote: First question - is it possible to set font to default OS font for window text? It would be preferable, while on my Windows XP system Tkinter sets small Helvetica-style font by default. Secondly, can I set font globally (or specify default font for widgets)? In fact, all I want is to get default OS font unless (rarely) I need to specify another. Go to: http://www.pythonware.com/library/tkinter/introduction/ Read chapter 6, Widget Styling, there is a section on Fonts which has a sub-section on System Fonts. None of them is suitable as a default text font. Prior to Tk 8.5, there is no way to get the right fonts used by the OS/desktop/theme. Tk 8.5 may provide that, but I haven't got it yet (see http://www.tcl.tk/cgi-bin/tct/tip/145.html) Regarding my questions, I guess both are impossible in Tkinter (as I didn't found anything about that in any Tkinter documentation), but there still must be a way to get the default OS font name and size (maybe outside of Tkinter), because it's always advised to use them in applications. Yes. Your second question is easy; google for tkinter default font. To obtain the desired font description, on Windows, you can use the pywin32 package or ctypes to call the following functions, and then configure Tkinter to use the desired font by default. Use SystemParametersInfo(SPI_GETNONCLIENTMETRICS,...) to obtain a NONCLIENTMETRICS structure. From it, obtain the lfMessageFont field (this is the default font for message boxes; you may be interested on others too, like lfMenuFont). It has all the info you need: lfFaceName is the font name, the various flags determine the font style, note that bold == lfWeight=500. Maybe lfHeight it's a bit complicated; it's the height in pixels, to convert to points (1/72): hdc = GetDC(0) dpi = GetDeviceCaps(hdc, LOGPIXELSY) font_size = int(round(abs(lfHeight) * 72 / dpi)) ReleaseDC(0, hdc) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: Formatting arrays using myarrayy.tolist()
Max Abrahams wrote: I've got an array that looks like this: p.xv[20:25] array([[ 1.60783821e-01, 1.04174046e+01, -1.74045566e-03, 6.02421398e-01, 2.16078382e+00, -1.60783821e-02], [ 1.66704816e-01, 1.04390422e+01, -1.90421758e-03, 5.81767402e-01, 2.16670482e+00, -1.66704816e-02], [ 1.72418976e-01, 1.04607380e+01, -2.07379715e-03, 5.61054649e-01, 2.17241898e+00, -1.72418976e-02], [ 1.77925722e-01, 1.04824899e+01, -2.24898715e-03, 5.40285230e-01, 2.17792572e+00, -1.77925722e-02], [ 1.83224500e-01, 1.05042958e+01, -2.42957975e-03, 5.19461244e-01, 2.18322450e+00, -1.83224500e-02]]) I want to dump it to a plain text file. The problem is, it unravels the array. The text file will look like this p.xv.tofile('file','\n') 10.3528613872 -0.00128613872188 0.664009998909 2.14178590964 -0.0141785909637 0.148323738585 10.3743121062 -0.0014312106189 and so on. i want it to look like this: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 any help would be appreciated. thanks. array is for single dimension arrays. You might look at numpy which deals with multidimensional arrays. Colin W. -- http://mail.python.org/mailman/listinfo/python-list
Re: Multiple interpreters retaining huge amounts of memory
What objects need to be shared across interpreters? My thought was to add an interpreter number to the PyThreadState structure, to increment it when Py_NewInterpreter is called, and to keep track of the interpreter that creates each object. On deletion, all memory belonging to these objects would be freed. Thoughts? That won't work, unless you make *massive* changes to Python. There are many global objects that are shared across interpreters: Py_None, Py_True, PyExc_ValueError, PyInt_Type, and so on. They are just C globals, and there can be only a single one of them. If you think you can fix that, start by changing Python so that Py_None is per-interpreter, then continue with PyBaseObject_Type. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: Formatting arrays using myarrayy.tolist()
sorry, i should've been more specific, this is a numpy array. -- http://mail.python.org/mailman/listinfo/python-list
Re: Server side cookie problems
En Wed, 06 Feb 2008 15:27:53 -0200, rodmc [EMAIL PROTECTED] escribi�: Hi, I am trying to set a cookie on a client computer using the Cookie module however all I get is the text being printed in the browser window. Can anyone point me in the right direction so that the cookie def writetocookie(number): #writes the ID of the database entry to a cookie cookie[dataid]=number print Content-Type: text/html print print Set-Cookie: dataid=,cookie[dataid].value I presume this is not the correct way to write a cookie, the examples I have found online don't seem to provide much more information. I don't know either if this is the right way, but surely the Set-Cookie header must appear *before* the blank line; that blank line separates the headers from the response body. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Professional Grant Proposal Writing Workshop (May 2008: Salt Lake City, Utah)
The Grant Institute's Grants 101: Professional Grant Proposal Writing Workshop will be held in Salt Lake City, Utah, May12 -14, 2008. Interested development professionals, researchers, faculty, and graduate students should register as soon as possible, as demand means that seats will fill up quickly. Please forward, post, and distribute this e-mail to your colleagues and listservs. All participants will receive certification in professional grant writing from the Institute. For more information call (888) 824 -4424 or visit The Grant Institute at www.thegrantinstitute.com. Please find the program description below: The Grant Institute Grants 101: Professional Grant Proposal Writing Workshop will be held in Salt Lake City, Utah May 12 - 14, 2008 8:00 AM - 5:00 PM The Grant Institute's Grants 101 course is an intensive and detailed introduction to the process, structure, and skill of professional proposal writing. This course is characterized by its ability to act as a thorough overview, introduction, and refresher at the same time. In this course, participants will learn the entire proposal writing process and complete the course with a solid understanding of not only the ideal proposal structure, but a holistic understanding of the essential factors, which determine whether or not a program gets funded. Through the completion of interactive exercises and activities, participants will complement expert lectures by putting proven techniques into practice. This course is designed for both the beginner looking for a thorough introduction and the intermediate looking for a refresher course that will strengthen their grant acquisition skills. This class, simply put, is designed to get results by creating professional grant proposal writers. Participants will become competent program planning and proposal writing professionals after successful completion of the Grants 101 course. In three active and informative days, students will be exposed to the art of successful grant writing practices, and led on a journey that ends with a masterful grant proposal. Grants 101 consists of three (3) courses that will be completed during the three-day workshop. (1) Fundamentals of Program Planning This course is centered on the belief that "it's all about the program." This intensive course will teach professional program development essentials and program evaluation. While most grant writing "workshops" treat program development and evaluation as separate from the writing of a proposal, this class will teach students the relationship between overall program planning and grant writing. (2) Professional Grant Writing Designed for both the novice and experienced grant writer, this course will make each student an overall proposal writing specialist. In addition to teaching the basic components of a grant proposal, successful approaches, and the do's and don'ts of grant writing, this course is infused with expert principles that will lead to a mastery of the process. Strategy resides at the forefront of this course's intent to illustrate grant writing as an integrated, multidimensional, and dynamic endeavor. Each student will learn to stop writing the grant and to start writing the story. Ultimately, this class will illustrate how each component of the grant proposal represents an opportunity to use proven techniques for generating support. (3) Grant Research At its foundation, this course will address the basics of foundation, corporation, and government grant research. However, this course will teach a strategic funding research approach that encourages students to see research not as something they do before they write a proposal, but as an integrated part of the grant seeking process. Students will be exposed to online and database research tools, as well as publications and directories that contain information about foundation, corporation, and government grant opportunities. Focusing on funding sources and basic social science research, this course teaches students how to use research as part of a strategic grant acquisition effort. Registration $597.00tuition includes all materials and certificates. Each student will receive: *The Grant Institute Certificate in Professional Grant Writing *The Grant Institute's Guide to Successful Grant Writing *The Grant Institute Grant Writer's Workbook with sample proposals, forms, and outlines Registration Methods 1) On-Line- Complete the online registration form at www.thegrantinstitute.com under Register Now. We'll send your confirmation by e-mail. 2) By Phone - Call (888) 824 - 4424to register by phone. Our friendly Program Coordinators will be happy to assist you and answer your questions. 3) By E-mail - Send an e-mail with your name, organization, and basic contact information to [EMAIL PROTECTED] and we will reserve your slot and send your Confirmation Packet. You have received this invitation due to specific educational affiliation. We respect
Re: Paramiko SFTP autologon using id_dsa.pub
Thanks for the response, is there an example bit of code somewhere i could digest ? On Feb 6, 1:35 pm, Martin v. Löwis [EMAIL PROTECTED] wrote: I wrote a lil module using paramiko's module to send a file via sftp.. it works great using the username and password. I would prefer to use id_dsa.pub to have an autologon and not save the password anywhere on the disk.. I cant find a good example of this. Can anyone help ? When you have an ssh-agent running that has the key loaded, paramiko will automatically use that. If you don't have an ssh-agent running, you have to pass either the pkey or the key_filename argument; the former should be a PKey object (either RSAKey or DSSKey). Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: Broke my IDLE!
Just to clarify my earlier comment... IDLE (on Windows, at least) creates a folder called .idlerc in the current directory when it is called. If you amend the key bindings two files, config-keys.cfg and config-main.cfg are created. config- keys.cfg contains the amended key bindings and config-main.cfg contains the name of the key binding file if it is not the platform default. The config processing seems to happen in python_root/Lib/idlelib/ configHandler.py. Sorry for the inaccuracy in the first post, Cheers, Kev -- http://mail.python.org/mailman/listinfo/python-list
Re: Formatting arrays using myarrayy.tolist()
URL:http://www.scipy.org/Cookbook/InputOutput hth, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list
Re: Why chdir command doesn't work with client.get_transport() ?
Thank you, Matt, for your valuable advice! My application is converting (to sftp/ssh) a script which used ftp/telnet to load/copy/zip files with labels to/from a ClearCase server. ClearCase is a version control software similar to MS Source Safe or PVCS. The command 'ct setview aViewName' is just one of my commands which worked fine using telnet. If you don't type this command and type 'cd aDirNameInClearCase', it won't work. After typing 'ct ...', the prompt will be changed and the 'cd ...' command will work. Now my problem has been solved. I used the class channel's get_pty(), invoke_shell() and sendall() functions. Basically I used an interactive shell, so that I could issue commands one by one like using telnet. Charles 2/6 -- View this message in context: http://www.nabble.com/Why-chdir-command-doesn%27t-work-with-client.get_transport%28%29---tp15248798p15312652.html Sent from the Python - python-list mailing list archive at Nabble.com. -- http://mail.python.org/mailman/listinfo/python-list
Adding properties to an instance
Hi all, So I understand that properties belong to a class not an instance, but nonetheless I want to add properties to an instance. I have a class which when an instance is created runs some fairly complicated code and produces a set of names which I'd like to be able to access via properties. At the moment, I'm using something like obj.getvar(name) but I'd like to be able to write obj.name. (Note that they can't be just standard attributes because they only get computed when they are accessed.) I could generate functions like obj.name() but I want it to be obj.name instead. The solution I've come up with is to create a new class for each object which is just the real class with some extra properties, and then dynamically change the class of the object to this new class. This seems to work, but I wonder if (a) there is a nicer solution than the one I'll post below, (b) if there are any dangers or pitfalls of this approach. The obvious difficulty is with derived classes. At the moment, I'm insisting that a derived class has to call a makeprops() method to create the properties. It's kind of similar to this recipe: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/197965 but that recipe has a much simpler situation in which the properties and values are known at the time of the creation of the object (by contrast, I don't know what the properties are until the end of the __init__ method). Any thoughts? Code below to illustrate my approach. import warnings from operator import itemgetter class A(object): def __init__(self,**kwds): self._kwds = kwds self.makeprops() def __getitem__(self,i): return self._kwds[i] def makeprops(self): if not hasattr(self,'_madeprops'): self._madeprops = set() self._failedprops = set() class _A(self.__class__): pass for k,v in self._kwds.items(): if not k in self._madeprops and k in dir(self): if not k in self._failedprops: warnings.warn(Cannot create property +k+, already used in object +str(self),RuntimeWarning) self._failedprops.add(k) else: setattr(_A,k,property(fget=itemgetter(k))) self._madeprops.add(k) self.__class__ = _A class B(A): def __init__(self,**kwds): super(B,self).__init__(**kwds) self.makeprops() class C(A): def __init__(self,**kwds): self._kwds = kwds a = A(x=1) b = B(x=2,makeprops=3) c = C(x=3) print isinstance(a,A), isinstance(a,B), isinstance(a,C) # True False False print isinstance(b,A), isinstance(b,B), isinstance(b,C) # True True False print isinstance(c,A), isinstance(c,B), isinstance(c,C) # True False True print a.__class__ # class '__main__._A' print b.__class__ # class '__main__._A' print c.__class__ # class '__main__.C' print a.x # 1 print b.x # 2 print b.makeprops # bound method _A.makeprops of __main__._A object at 0x00A86810 try: print c.x # raises exception except AttributeError: print c has no element x c.makeprops() print c.x # 3 print a.__class__ # class '__main__._A' print b.__class__ # class '__main__._A' print c.__class__ # class '__main__._A' --- Dan Goodman http://thesamovar.net/contact -- http://mail.python.org/mailman/listinfo/python-list
Re: Paramiko SFTP autologon using id_dsa.pub
Mike Hjorleifsson wrote: Thanks for the response, is there an example bit of code somewhere i could digest ? I did c.connect(hostname,username=loewis) with ssh-agent, and it worked just fine. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: Adding properties to an instance
Here's one way of doing what you're asking... I would suggest using __getattribute__ and __setattr__ to dispatch the methods to the custom class you invent that holds all those properties. For example (I simplified your makeprops into __init__ just to keep the example short, but you can probably see the idea here..) class A(object): def __init__(self, **kw): class _PropHolder(object): pass for k,v in kw.items(): setattr(_PropHolder, k, property(fget=itemgetter(k))) self._custom_props = _PropHolder() def __getattribute__(self, attr): try: return getattr(self._custom_props, attr) except AttributeError: return getattr(self, attr) def __setattr__(self, attr, val): if hasattr(self._custom_props, attr): setattr(self._custom_props, attr, val) else: setattr(self, attr, val) def __delattr__(self, attr): if hasattr(self._custom_props, attr): delattr(self._custom_props, attr) else: delattr(self, attr) On 6 Feb 2008, at 12:06, [EMAIL PROTECTED] wrote: Hi all, So I understand that properties belong to a class not an instance, but nonetheless I want to add properties to an instance. I have a class which when an instance is created runs some fairly complicated code and produces a set of names which I'd like to be able to access via properties. At the moment, I'm using something like obj.getvar(name) but I'd like to be able to write obj.name. (Note that they can't be just standard attributes because they only get computed when they are accessed.) I could generate functions like obj.name() but I want it to be obj.name instead. The solution I've come up with is to create a new class for each object which is just the real class with some extra properties, and then dynamically change the class of the object to this new class. This seems to work, but I wonder if (a) there is a nicer solution than the one I'll post below, (b) if there are any dangers or pitfalls of this approach. The obvious difficulty is with derived classes. At the moment, I'm insisting that a derived class has to call a makeprops() method to create the properties. It's kind of similar to this recipe: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/197965 but that recipe has a much simpler situation in which the properties and values are known at the time of the creation of the object (by contrast, I don't know what the properties are until the end of the __init__ method). Any thoughts? Code below to illustrate my approach. import warnings from operator import itemgetter class A(object): def __init__(self,**kwds): self._kwds = kwds self.makeprops() def __getitem__(self,i): return self._kwds[i] def makeprops(self): if not hasattr(self,'_madeprops'): self._madeprops = set() self._failedprops = set() class _A(self.__class__): pass for k,v in self._kwds.items(): if not k in self._madeprops and k in dir(self): if not k in self._failedprops: warnings.warn(Cannot create property +k+, already used in object +str(self),RuntimeWarning) self._failedprops.add(k) else: setattr(_A,k,property(fget=itemgetter(k))) self._madeprops.add(k) self.__class__ = _A class B(A): def __init__(self,**kwds): super(B,self).__init__(**kwds) self.makeprops() class C(A): def __init__(self,**kwds): self._kwds = kwds a = A(x=1) b = B(x=2,makeprops=3) c = C(x=3) print isinstance(a,A), isinstance(a,B), isinstance(a,C) # True False False print isinstance(b,A), isinstance(b,B), isinstance(b,C) # True True False print isinstance(c,A), isinstance(c,B), isinstance(c,C) # True False True print a.__class__ # class '__main__._A' print b.__class__ # class '__main__._A' print c.__class__ # class '__main__.C' print a.x # 1 print b.x # 2 print b.makeprops # bound method _A.makeprops of __main__._A object at 0x00A86810 try: print c.x # raises exception except AttributeError: print c has no element x c.makeprops() print c.x # 3 print a.__class__ # class '__main__._A' print b.__class__ # class '__main__._A' print c.__class__ # class '__main__._A' --- Dan Goodman http://thesamovar.net/contact -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Adding properties to an instance
Er, instead of getattr(self,...) you gotta do object.__getattr__(self,...) and same for setattr and delattr. Dumb error on my part. (Otherwise you get infinite recursion!) On Feb 6, 2008 12:43 PM, Jared Grubb [EMAIL PROTECTED] wrote: Here's one way of doing what you're asking... I would suggest using __getattribute__ and __setattr__ to dispatch the methods to the custom class you invent that holds all those properties. For example (I simplified your makeprops into __init__ just to keep the example short, but you can probably see the idea here..) class A(object): def __init__(self, **kw): class _PropHolder(object): pass for k,v in kw.items(): setattr(_PropHolder, k, property(fget=itemgetter(k))) self._custom_props = _PropHolder() def __getattribute__(self, attr): try: return getattr(self._custom_props, attr) except AttributeError: return getattr(self, attr) def __setattr__(self, attr, val): if hasattr(self._custom_props, attr): setattr(self._custom_props, attr, val) else: setattr(self, attr, val) def __delattr__(self, attr): if hasattr(self._custom_props, attr): delattr(self._custom_props, attr) else: delattr(self, attr) On 6 Feb 2008, at 12:06, [EMAIL PROTECTED] wrote: Hi all, So I understand that properties belong to a class not an instance, but nonetheless I want to add properties to an instance. I have a class which when an instance is created runs some fairly complicated code and produces a set of names which I'd like to be able to access via properties. At the moment, I'm using something like obj.getvar(name) but I'd like to be able to write obj.name. (Note that they can't be just standard attributes because they only get computed when they are accessed.) I could generate functions like obj.name() but I want it to be obj.name instead. The solution I've come up with is to create a new class for each object which is just the real class with some extra properties, and then dynamically change the class of the object to this new class. This seems to work, but I wonder if (a) there is a nicer solution than the one I'll post below, (b) if there are any dangers or pitfalls of this approach. The obvious difficulty is with derived classes. At the moment, I'm insisting that a derived class has to call a makeprops() method to create the properties. It's kind of similar to this recipe: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/197965 but that recipe has a much simpler situation in which the properties and values are known at the time of the creation of the object (by contrast, I don't know what the properties are until the end of the __init__ method). Any thoughts? Code below to illustrate my approach. import warnings from operator import itemgetter class A(object): def __init__(self,**kwds): self._kwds = kwds self.makeprops() def __getitem__(self,i): return self._kwds[i] def makeprops(self): if not hasattr(self,'_madeprops'): self._madeprops = set() self._failedprops = set() class _A(self.__class__): pass for k,v in self._kwds.items(): if not k in self._madeprops and k in dir(self): if not k in self._failedprops: warnings.warn(Cannot create property +k+, already used in object +str(self),RuntimeWarning) self._failedprops.add(k) else: setattr(_A,k,property(fget=itemgetter(k))) self._madeprops.add(k) self.__class__ = _A class B(A): def __init__(self,**kwds): super(B,self).__init__(**kwds) self.makeprops() class C(A): def __init__(self,**kwds): self._kwds = kwds a = A(x=1) b = B(x=2,makeprops=3) c = C(x=3) print isinstance(a,A), isinstance(a,B), isinstance(a,C) # True False False print isinstance(b,A), isinstance(b,B), isinstance(b,C) # True True False print isinstance(c,A), isinstance(c,B), isinstance(c,C) # True False True print a.__class__ # class '__main__._A' print b.__class__ # class '__main__._A' print c.__class__ # class '__main__.C' print a.x # 1 print b.x # 2 print b.makeprops # bound method _A.makeprops of __main__._A object at 0x00A86810 try: print c.x # raises exception except AttributeError: print c has no element x c.makeprops() print c.x # 3 print a.__class__ # class '__main__._A' print b.__class__ # class '__main__._A' print c.__class__ # class '__main__._A' --- Dan Goodman http://thesamovar.net/contact -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Code block function syntax, anonymous functions decorator
def run3( block ): for _ in range( 3 ): block() run3(): normal_suite() Introduces new syntax; arbitrary functions can follow 'colon'. Maintains readability, meaning is consistent. Equivalent to: def run3( block ): for _ in range( 3 ): block() @run3 def anonfunc(): normal_suite() Simplification in cases in which decorators are use often. -- http://mail.python.org/mailman/listinfo/python-list
Is there a way to use .NET DLL from Python
Hello All, I have several .NET DLL (I have no source code for them), is there anyway to use them from python instead of from C#. Thanks, Huayang -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a way to use .NET DLL from Python
The following links *may* put you on the right path: Calling DLL functions from Python ( http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/146847 ), a fairly complete description with some helper class code. Another example ( http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/181063 ) of using the calldll module to do this. calldll module: http://www.nightmare.com/software.html http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/146847 Huayang Xia wrote: Hello All, I have several .NET DLL (I have no source code for them), is there anyway to use them from python instead of from C#. Thanks, Huayang -- Shane Geiger IT Director National Council on Economic Education [EMAIL PROTECTED] | 402-438-8958 | http://www.ncee.net Leading the Campaign for Economic and Financial Literacy -- http://mail.python.org/mailman/listinfo/python-list
Re: IronPython vs CPython: faster in 1.6 times?
On Feb 5, 7:47 pm, Stefan Behnel [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] schrieb: Mike C. Fletcher: Not sure if Mono also provides a speedup. There is a set of good benchmarks here, the answer is negative: http://shootout.alioth.debian.org/sandbox/benchmark.php?test=alllang... This doesn't look like Mono to me: IronPython1.1 (1.1) on .NET 2.0.50727.42 Running on Debian? Fairly unlikely. :-) Fuzzyman http://www.manning.com/foord Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: IronPython vs CPython: faster in 1.6 times?
On Feb 5, 6:52 pm, Steve Holden [EMAIL PROTECTED] wrote: Jeff wrote: IronPythonruns on top of .NET. I would be suspect of any claims that it is faster than cPython, just as I would of claims that Stackless or Jython are faster. Well don't be. There are benchmarks that clearly showIronPythonas faster for selected tests. Other tests show CPython running more quickly. This has been our experience at Resolver Systems. Code that makes heavy use of function calls, non-exceptional exception handling or arithmetic tends to run faster whereas the built-in types tend to be slower. It makes profiling code for optimisation all the more important because all your usual assumptions about Python performance tend to be wrong... Michael Foord http://www.manning.com/foord As always, a benchmark is only really valuable on a typical workload for the intended application. regards Steve -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: IronPython vs CPython: faster in 1.6 times?
On Wed, 2008-02-06 at 13:39 -0800, Fuzzyman wrote: On Feb 5, 7:47 pm, Stefan Behnel [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] schrieb: Mike C. Fletcher: Not sure if Mono also provides a speedup. There is a set of good benchmarks here, the answer is negative: http://shootout.alioth.debian.org/sandbox/benchmark.php?test=all〈... This doesn't look like Mono to me: IronPython1.1 (1.1) on .NET 2.0.50727.42 Running on Debian? Fairly unlikely. :-) Well, that *is* what the version string reports for IronPython on Mono on Linux: $ uname -sr Linux 2.6.18-1.2200.fc5smp $ mono ipy.exe IronPython 1.1 (1.1) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. -- Carsten Haese http://informixdb.sourceforge.net -- http://mail.python.org/mailman/listinfo/python-list
Re: package import
Thanks. Found that 10 minutes after I sent. On Feb 6, 2008, at 4:57 AM, Diez B. Roggisch wrote: Sean Allen wrote: ok, what am i doing wrong? in current working directory i have: t.py sub/t1.py t.py is: import sub.t1 i get: ImportError: No module named sub.t1 t.py is import sub i get: ImportError: No module named sub.t1 -- i am obviously missing something really basic here. have tried on multiple machines, linux and mac os x. http://docs.python.org/tut/node8.html#SECTION00840 Diez -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Adding properties to an instance
En Wed, 06 Feb 2008 18:06:48 -0200, [EMAIL PROTECTED] escribió: So I understand that properties belong to a class not an instance, but nonetheless I want to add properties to an instance. I have a class which when an instance is created runs some fairly complicated code and produces a set of names which I'd like to be able to access via properties. I'd suggest a small improvement: _A as a class name isn't very nice. Replace the inner class statement with: _A = type(self.__class__.__name__ + '_autoprops', (self.__class__,), {}) A problem with this approach is that instances aren't pickleable (perhaps that could be solved using __reduce__) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: IronPython vs CPython: faster in 1.6 times?
Isaac Gouy wrote: On Feb 5, 11:47 am, Stefan Behnel [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] schrieb: Mike C. Fletcher: Not sure if Mono also provides a speedup. There is a set of good benchmarks here, the answer is negative: http://shootout.alioth.debian.org/sandbox/benchmark.php?test=alllang... This doesn't look like Mono to me: IronPython 1.1 (1.1) on .NET 2.0.50727.42 Stefan Have you actually looked at the version string from IronPython-1.1- Bin.zip running on Mono? Why? Would that look like Mono? :) Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: IronPython vs CPython: faster in 1.6 times?
Fuzzyman wrote: On Feb 5, 7:47 pm, Stefan Behnel [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] schrieb: Mike C. Fletcher: Not sure if Mono also provides a speedup. There is a set of good benchmarks here, the answer is negative: http://shootout.alioth.debian.org/sandbox/benchmark.php?test=alllang... This doesn't look like Mono to me: IronPython1.1 (1.1) on .NET 2.0.50727.42 Running on Debian? Fairly unlikely. :-) Why? Wasn't .NET supposed to be platform independent code and all that? ;) Stefan -- http://mail.python.org/mailman/listinfo/python-list
RE: Why not a Python compiler?
Reedick, Andrew wrote: -Original Message- From: [EMAIL PROTECTED] [mailto:python- [EMAIL PROTECTED] On Behalf Of Grant Edwards Nothing can travel faster than the speed of light _in_a_vacuum_. There are situtaitons where things can (and regularly do) travel faster than light: http://en.wikipedia.org/wiki/Cherenkov_radiation Nope. It propagates, not travels, faster than light. Go ask a physicist to explain it. It's odd... So let me see if I understood this correctly: C travels, C++ propagates? :-) -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a way to use .NET DLL from Python
On Feb 6, 6:27 pm, Huayang Xia [EMAIL PROTECTED] wrote: Hello All, I have several .NET DLL (I have no source code for them), is there anyway to use them from python instead of from C#. Thanks, Huayang I used to put my .dll files into the .DLL folder, so I could simply import them as I would with any other python module. But since I started using Ironpython 2.0 Alpha* this doesn't work anymore... Any hint? Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: TheSchwartz in Python?
Cool, but sched saves job in memory... cron can't be an option. It's just a scheduler not a job queue. On Feb 7, 2008 1:36 AM, Larry Bates [EMAIL PROTECTED] wrote: js wrote: Hi, I'm looking for a job queue manager in Python, like TheSchwartz.[1]. I found there's TheSchawrtz server, RPC server powered by Gearman, to which Python/Ruby can connect [2], but setting up two languages env is a little cumbersome to me. Is there any alternative to that in Python? The requirement is * Store job queue in disk, not memory * Easy to set up * 100% Python Any pointers would be appliciated. Thanks. [1] http://search.cpan.org/~bradfitz/TheSchwartz-1.04/lib/TheSchwartz.pm [2] http://brad.livejournal.com/2332359.html Are you sure CRON won't do the job for you. If not, then you may want to at least take a look at Python's sched module (if you haven't already). -Larry -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Looking for library to estimate likeness of two strings
Are there any Python libraries implementing measurement of similarity of two strings of Latin characters? I'm writing a script to guess-merge two tables based on people's names, which are not necessarily spelled the same way in both tables (especially the given names). I would like some function that would help me make the best guess. Many thanks in advance! -- http://mail.python.org/mailman/listinfo/python-list
getting all user defined attributes of a class
Hi How do I get user defined attributes of a class? e.g Class A(object) : self.x = 1 -- I want something like: for userattrib in A.getAllUserAttribute() : print userattrib My question is, is there a builtin function, called getAllUserAttributes? Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Adding properties to an instance
On 6 fév, 21:06, [EMAIL PROTECTED] wrote: Hi all, So I understand that properties belong to a class not an instance, but nonetheless I want to add properties to an instance. While this is technically possible (I tried a couple years ago), it requires hacking the __getattribute__ method, which is something I would not recommand, not only because it can be tricky, but mostly because this is a very critical path wrt/ perfs. (IIRC it also required using custom descriptors, but I'm not really sure about this last point). I have a class which when an instance is created runs some fairly complicated code and produces a set of names which I'd like to be able to access via properties. At the moment, I'm using something like obj.getvar(name) but I'd like to be able to write obj.name. Before new-style classes, we used the __getattr__/__setattr__ hooks for computed attributes. While this approach is now a bit abandonned in favor of descriptors (properties or custom ones), it still works fine, and is probably the best solution to your problem. HTH -- http://mail.python.org/mailman/listinfo/python-list
Re: getting all user defined attributes of a class
On Wed, 06 Feb 2008 14:07:23 -0800, Amit Gupta wrote: Class A(object) : self.x = 1 This is not valid Python code. I want something like: for userattrib in A.getAllUserAttribute() : print userattrib My question is, is there a builtin function, called getAllUserAttributes? No and there can't be since the attributes you seem to be interested in don't exist until an instance is created. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list
Re: Looking for library to estimate likeness of two strings
Are there any Python libraries implementing measurement of similarity of two strings of Latin characters? It sounds like you're interested in calculating the Levenshtein distance: http://en.wikipedia.org/wiki/Levenshtein_distance which gives you a measure of how different they are. A measure of 0 is that the inputs are the same. The more different the two strings are, the greater the resulting output of the function. Unfortunately, it's an O(MN) algorithm (where M=len(word1) and N=len(word2)) from my understanding of the code I've seen. However it really is the best approximation I've seen of a how similar are these two strings function. Googling for python levenshtein distance brings up oodles of hits. -tkc -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a way to use .NET DLL from Python
On Feb 6, 4:59 pm, Luis M. González [EMAIL PROTECTED] wrote: On Feb 6, 6:27 pm, Huayang Xia [EMAIL PROTECTED] wrote: Hello All, I have several .NET DLL (I have no source code for them), is there anyway to use them from python instead of from C#. Thanks, Huayang I used to put my .dll files into the .DLL folder, so I could simply import them as I would with any other python module. But since I started using Ironpython 2.0 Alpha* this doesn't work anymore... Any hint? Luis Is there anyway to import class (to generate objects) from .NET DLL? -- http://mail.python.org/mailman/listinfo/python-list
Re: Paramiko SFTP autologon using id_dsa.pub
sorry i meant a code example that i pass the id_dsa.pub file contents too so i am not reliant on the host system to have the ssh-agent. On Feb 6, 3:09 pm, Martin v. Löwis [EMAIL PROTECTED] wrote: Mike Hjorleifsson wrote: Thanks for the response, is there an example bit of code somewhere i could digest ? I did c.connect(hostname,username=loewis) with ssh-agent, and it worked just fine. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a way to use .NET DLL from Python
Or maybe we can do it in IronPython? -- http://mail.python.org/mailman/listinfo/python-list
Re: TheSchwartz in Python?
js wrote: Cool, but sched saves job in memory... cron can't be an option. It's just a scheduler not a job queue. Note that at and batch *are* job queues. regards Steve -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a way to use .NET DLL from Python
Huayang Xia wrote: I have several .NET DLL (I have no source code for them), is there anyway to use them from python instead of from C#. En Wed, 06 Feb 2008 19:37:02 -0200, Shane Geiger [EMAIL PROTECTED] escribió: Calling DLL functions from Python (http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/146847 ), a fairly complete description with some helper class code. Another example ( http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/181063 ) of using the calldll module to do this. Both recipes are rather obsolete now, since version 2.5 ctypes is included in the standard library. Anyway they don't help the OP to load a .NET dll; there is PythonDotNET http://pythonnet.sf.net/ but I've never used it myself. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: getting all user defined attributes of a class
On Feb 6, 2:15 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Wed, 06 Feb 2008 14:07:23 -0800, Amit Gupta wrote: Class A(object) : self.x = 1 This is not valid Python code. I want something like: for userattrib in A.getAllUserAttribute() : print userattrib My question is, is there a builtin function, called getAllUserAttributes? No and there can't be since the attributes you seem to be interested in don't exist until an instance is created. Ciao, Marc 'BlackJack' Rintsch My mistake: I should make class A as: class A (object) : x = 1 Now, x is class attribute and I am looking for some-way to filter non- user-defined attributes. e.g.g if I do for attr in a.__dict__ : print attr I will also get __module__, __weakref__ and others including x Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: TheSchwartz in Python?
Cool, but sched saves job in memory... cron can't be an option. It's just a scheduler not a job queue. You could probably make lpd do what you want to do. -- damjan -- http://mail.python.org/mailman/listinfo/python-list
mysqldb: Rows READ or Processed
I have looked through Python Database API Specification v2.0, but can not find any reference to the number of records processed in a select query. I know I can get the number of records returned with cursor.rowcount, but I want to know the number of records processed. I suppose the info is in one of the internal tables, but I can not find any info on that, because phpMyAdmin shows the number of rows in a table. I suppose I could use count(*), but would that process all the records, which would seem a bit silly. What is the best method ? Richard -- http://mail.python.org/mailman/listinfo/python-list
Re: Adding properties to an instance
On Feb 6, 10:54 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: I'd suggest a small improvement: _A as a class name isn't very nice. Replace the inner class statement with: _A = type(self.__class__.__name__ + '_autoprops', (self.__class__,), {}) Ah yes, that's much nicer. A problem with this approach is that instances aren't pickleable (perhaps that could be solved using __reduce__) I think because the properties can be computed from knowing the rest of the data of the object, it would be safe when pickling to just pickle a copy of the object with the __class__ changed back to A (and then when you load it again, you can just generate the properties anew). I haven't really thought much about pickling but it would certainly be a nice feature to have. -- Dan -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a way to use .NET DLL from Python
Huayang Xia wrote: Is there anyway to import class (to generate objects) from .NET DLL? You can use PythonDotNET if you want to access .NET assemblies in CPython (the standard Python implementation written in C). Christian -- http://mail.python.org/mailman/listinfo/python-list
Re: getting all user defined attributes of a class
Amit Gupta schrieb: On Feb 6, 2:15 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Wed, 06 Feb 2008 14:07:23 -0800, Amit Gupta wrote: Class A(object) : self.x = 1 This is not valid Python code. I want something like: for userattrib in A.getAllUserAttribute() : print userattrib My question is, is there a builtin function, called getAllUserAttributes? No and there can't be since the attributes you seem to be interested in don't exist until an instance is created. Ciao, Marc 'BlackJack' Rintsch My mistake: I should make class A as: class A (object) : x = 1 Now, x is class attribute and I am looking for some-way to filter non- user-defined attributes. e.g.g if I do for attr in a.__dict__ : print attr I will also get __module__, __weakref__ and others including x Just create an empty class, gather all attribute names from that and then subtract that set of names from the names you get from a real class. Dize -- http://mail.python.org/mailman/listinfo/python-list
Re: Looking for library to estimate likeness of two strings
Tim Chase wrote: Are there any Python libraries implementing measurement of similarity of two strings of Latin characters? It sounds like you're interested in calculating the Levenshtein distance: http://en.wikipedia.org/wiki/Levenshtein_distance which gives you a measure of how different they are. A measure of 0 is that the inputs are the same. The more different the two strings are, the greater the resulting output of the function. Unfortunately, it's an O(MN) algorithm (where M=len(word1) and N=len(word2)) from my understanding of the code I've seen. However it really is the best approximation I've seen of a how similar are these two strings function. Googling for python levenshtein distance brings up oodles of hits. If the strings happen to be the same length, the Levenshtein distance is equivalent to the Hamming distance. The Wikipedia article gives the following Python implementation: # http://en.wikipedia.org/wiki/Hamming_distance def hamdist(s1, s2): assert len(s1) == len(s2) return sum(ch1 != ch2 for ch1, ch2 in zip(s1, s2)) -- http://mail.python.org/mailman/listinfo/python-list
Re: Code block function syntax, anonymous functions decorator
[EMAIL PROTECTED] schrieb: def run3( block ): for _ in range( 3 ): block() run3(): normal_suite() Introduces new syntax; arbitrary functions can follow 'colon'. Maintains readability, meaning is consistent. Equivalent to: def run3( block ): for _ in range( 3 ): block() @run3 def anonfunc(): normal_suite() Simplification in cases in which decorators are use often. This is non-sensical - how do you invoke anonfunc? They would all bind to the same name, run3. Or to no name as all, as your spec lacks that. Besides, it's butt-ugly IMHO. But taste comes after proper definition... Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: Adding properties to an instance
On Feb 6, 11:09 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: While this is technically possible (I tried a couple years ago), it requires hacking the __getattribute__ method, which is something I would not recommand, not only because it can be tricky, but mostly because this is a very critical path wrt/ perfs. (IIRC it also required using custom descriptors, but I'm not really sure about this last point). Performance is pretty important for the class I'm designing so I think __getattribute__ is probably out. The computed properties are only infrequently accessed, but using __getattribute__ slows everything down, right? Before new-style classes, we used the __getattr__/__setattr__ hooks for computed attributes. While this approach is now a bit abandonned in favor of descriptors (properties or custom ones), it still works fine, and is probably the best solution to your problem. Ah, I didn't know about these - it looks as though they might be just the thing since it seems they're only called after all the other methods fail. That looks like there would be no performance hit, I wouldn't need to mess around with dynamically changing the class, and it would automatically deal with the (irritating) feature of having to check if there is already something in the object's dir() with that name. I'll look into this tomorrow - I hope this feature isn't going to be removed in future versions of Python? -- Dan -- http://mail.python.org/mailman/listinfo/python-list
Re: getting all user defined attributes of a class
On Feb 6, 2:55 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: Amit Gupta schrieb: On Feb 6, 2:15 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Wed, 06 Feb 2008 14:07:23 -0800, Amit Gupta wrote: Class A(object) : self.x = 1 This is not valid Python code. I want something like: for userattrib in A.getAllUserAttribute() : print userattrib My question is, is there a builtin function, called getAllUserAttributes? No and there can't be since the attributes you seem to be interested in don't exist until an instance is created. Ciao, Marc 'BlackJack' Rintsch My mistake: I should make class A as: class A (object) : x = 1 Now, x is class attribute and I am looking for some-way to filter non- user-defined attributes. e.g.g if I do for attr in a.__dict__ : print attr I will also get __module__, __weakref__ and others including x Just create an empty class, gather all attribute names from that and then subtract that set of names from the names you get from a real class. Dize Fine. This is a hack. I am looking if python language itself provides any built-in function for this. E.g.: When I do help on some built-in function, it displays that function is built_in. Can that information get accessed using a function? (now, don't ask me to store help-output in buffer and grep for built-in). A -- http://mail.python.org/mailman/listinfo/python-list
python beginner problem(?)
Win2k Pro - installed python: ok Example 2.1 from DiveIntoPython tutorial copied and pasted into Pythonwin - Python IDE and GUI Framework for Windows. -- def buildConnectionString(params): Build a connection string from a dictionary of parameters. Returns string. return ;.join([%s=%s % (k, v) for k, v in params.items()]) if __name__ == __main__: myParams = {server:mpilgrim, \ database:master, \ uid:sa, \ pwd:secret \ } print buildConnectionString(myParams) -- produces.. = C:\Python25\Lib\site-packages\pythonwin\pywin\mfc\object.py: 23: DeprecationWarning: raising a string exception is deprecated raise win32ui.error, The MFC object has died. pwd=secret;database=master;uid=sa;server=mpilgrim = DiveIntoPython example 2.1 result: server=mpilgrim;uid=sa;database=master;pwd=secret ..which I realise is essentially the same (except for order). I haven't ever (not that I remember) installed MFC. Help! tia Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Formatting arrays using myarrayy.tolist()
[EMAIL PROTECTED] wrote: sorry, i should've been more specific, this is a numpy array. It's usually best to ask numpy questions on the numpy mailing list for this reason. http://www.scipy.org/Mailing_Lists -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list
Re: Looking for library to estimate likeness of two strings
Jeff Schwab wrote: Tim Chase wrote: Are there any Python libraries implementing measurement of similarity of two strings of Latin characters? It sounds like you're interested in calculating the Levenshtein distance: http://en.wikipedia.org/wiki/Levenshtein_distance which gives you a measure of how different they are. A measure of 0 is that the inputs are the same. The more different the two strings are, the greater the resulting output of the function. Unfortunately, it's an O(MN) algorithm (where M=len(word1) and N=len(word2)) from my understanding of the code I've seen. However it really is the best approximation I've seen of a how similar are these two strings function. Googling for python levenshtein distance brings up oodles of hits. If the strings happen to be the same length, the Levenshtein distance is equivalent to the Hamming distance. The Wikipedia article gives the following Python implementation: # http://en.wikipedia.org/wiki/Hamming_distance def hamdist(s1, s2): assert len(s1) == len(s2) return sum(ch1 != ch2 for ch1, ch2 in zip(s1, s2)) I'm afraid that it isn't. Using Magnus Lie Hetland's implementation: http://hetland.org/coding/python/levenshtein.py In [1]: %cpaste Pasting code; enter '--' alone on the line to stop. :def levenshtein(a,b): :Calculates the Levenshtein distance between a and b. :n, m = len(a), len(b) :if n m: :# Make sure n = m, to use O(min(n,m)) space :a,b = b,a :n,m = m,n : :current = range(n+1) :for i in range(1,m+1): :previous, current = current, [i]+[0]*n :for j in range(1,n+1): :add, delete = previous[j]+1, current[j-1]+1 :change = previous[j-1] :if a[j-1] != b[i-1]: :change = change + 1 :current[j] = min(add, delete, change) : :return current[n] :-- In [2]: In [3]: def hamdist(s1, s2): ...: assert len(s1) == len(s2) ...: return sum(ch1 != ch2 for ch1, ch2 in zip(s1, s2)) ...: In [4]: hamdist('abcdef', 'fabcde') Out[4]: 6 In [5]: levenshtein('abcdef', 'fabcde') Out[5]: 2 -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list
Re: Code block function syntax, anonymous functions decorator
On Wed, 06 Feb 2008 23:59:27 +0100, Diez B. Roggisch [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] schrieb: def run3( block ): for _ in range( 3 ): block() run3(): normal_suite() Introduces new syntax; arbitrary functions can follow 'colon'. Maintains readability, meaning is consistent. Equivalent to: def run3( block ): for _ in range( 3 ): block() @run3 def anonfunc(): normal_suite() Simplification in cases in which decorators are use often. This is non-sensical - how do you invoke anonfunc? They would all bind to the same name, run3. Or to no name as all, as your spec lacks that. As he said, the decorator version is the _equivalent_ to the syntax he was proposing. The point isn't to decorate the function, so perhaps he shouldn't have used decorator syntax, but instead: def anonfunc(): normal_suite() run3(anonfunc) del anonfunc So it's not non-sensical. It's a request for a piece of syntax. Besides, it's butt-ugly IMHO. But taste comes after proper definition... It's properly defined. Not that I'm endorsing this or anything. I'd rather not see half-assed syntax proposals at all, even if they're super great (and some of the syntax that's made it into Python is much worse than this). Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list
OT: Speed of light [was Re: Why not a Python compiler?]
On Wed, 06 Feb 2008 10:14:10 -0600, Reedick, Andrew wrote: 'c' is also the speed of light. 'c' is the speed of light _in_a_vacuum_. True. And since nothing can travel faster than light... Nothing can travel faster than the speed of light _in_a_vacuum_. There are situtaitons where things can (and regularly do) travel faster than light: http://en.wikipedia.org/wiki/Cherenkov_radiation Nope. It propagates, not travels, faster than light. Go ask a physicist to explain it. It's odd... Propagate, travel, what's the difference? If you're referring to the fact that in non-vacuum, light travels more slowly due to frequent interactions with the particles of the medium it travels through, that's discussed in the Wikipedia article. There are quite a number of superluminal (faster than light) phenomena. See, for example: http://en.wikipedia.org/wiki/Slow_light http://en.wikipedia.org/wiki/Phase_velocity http://en.wikipedia.org/wiki/Faster-than-light particularly the section titled: Superficially FTL phenomena which do not carry information -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: mysqldb: Rows READ or Processed
mcl wrote: I have looked through Python Database API Specification v2.0, but can not find any reference to the number of records processed in a select query. I know I can get the number of records returned with cursor.rowcount, but I want to know the number of records processed. If you mean the number of (say) rows updated by a SQL UPDATE statement, the DB API does not provide any way to access that information, although some implementations do have cursor.execute return it. I think MySQLdb is one of those ... I suppose the info is in one of the internal tables, but I can not find any info on that, because phpMyAdmin shows the number of rows in a table. Looky here: cn = db.connect(user=root, db=test, passwd=...) cu = cn.cursor() cu.execute(create table t1 (f1 integer primary key, f2 varchar(50))) 0L for i in range(20): ... cu.execute(INSERT INTO t1(f1, f2) VALUES(%s, %s), (i, str(i)*i)) ... 1L 1L 1L 1L 1L 1L 1L 1L 1L 1L 1L 1L 1L 1L 1L 1L 1L 1L 1L 1L cn.commit() cu.execute(UPDATE t1 SET f2='changed' WHERE f112) 12L As you can see, the execute method returns the number of rows affected by an operation. I suppose I could use count(*), but would that process all the records, which would seem a bit silly. I have written code that does exactly that: it keeps a field list separate from a set of conditions, and executes a SELECT count(*) FROM table WHERE + condition to determine how many rows will be affected. This is useful to maintain uniqueness constraints that aren't in the database, for example, and it's a valid technique. Don't worry about inefficiency until you have evidence that it occurs! What is the best method ? If you're happy to stick with MySQL, use the count returned from the cursor.execute() method. Otherwise, SELECT count(*) with the same conditions you'll be using for UPDATE. regards Steve -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: python beginner problem(?)
Alan Illeman wrote: Win2k Pro - installed python: ok Example 2.1 from DiveIntoPython tutorial copied and pasted into Pythonwin - Python IDE and GUI Framework for Windows. -- def buildConnectionString(params): Build a connection string from a dictionary of parameters. Returns string. return ;.join([%s=%s % (k, v) for k, v in params.items()]) if __name__ == __main__: myParams = {server:mpilgrim, \ database:master, \ uid:sa, \ pwd:secret \ } print buildConnectionString(myParams) -- produces.. = C:\Python25\Lib\site-packages\pythonwin\pywin\mfc\object.py: 23: DeprecationWarning: raising a string exception is deprecated raise win32ui.error, The MFC object has died. pwd=secret;database=master;uid=sa;server=mpilgrim = DiveIntoPython example 2.1 result: server=mpilgrim;uid=sa;database=master;pwd=secret ..which I realise is essentially the same (except for order). I haven't ever (not that I remember) installed MFC. Help! MFC is the Microsoft Foundation Classes, used by many Windows programmers to create applications. Mark Hammond, the author of PythonWin, used them to build that. I am hugely surprised to find that PythonWin apparently raises string exceptions: this is an old programming technique, which should have been removed from anything designed to run on Python 2.5. That is why you see the message: it's only a warning, so you can ignore it. I am copying Mark on this message in case he's unaware of the issue. Don't be surprised if the ordering of the elements in a dict is different between Python versions - a dict is an unordered collection, and so the ordering of the elements isn't supposed to be predictable. Mark Pilgrim probably used an earlier version of Python to prepare the examples, that text has been around some time (though it's still good). regards Steve -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: mysqldb: Rows READ or Processed
On Wed, 2008-02-06 at 18:53 -0500, Steve Holden wrote: If you mean the number of (say) rows updated by a SQL UPDATE statement, the DB API does not provide any way to access that information It doesn't? Isn't that what cursor.rowcount does? -- Carsten Haese http://informixdb.sourceforge.net -- http://mail.python.org/mailman/listinfo/python-list