how to append cgi FieldStorage Class instance

2005-07-29 Thread praba kar
Dear All, I have doubt in python cgi script. I describe that doubt with below code import cgi form = cgi.FieldStorage() passwd = form['passwd'].value print passwd But Now I want to assign some value to form['passwd'] field value form['passwd'] = 'surese' Now If I try to print print form['pas

RE: [path-PEP] Path inherits from basestring again

2005-07-29 Thread Tim Golden
[Tony Meyer] | | [Tim Golden] | > Well, I actually had some correspondence with Jason on this | > very subject a year or so ago: | [...] | > Obviously, I don't know how much weight Jason's original | > ideas have on the prepped-for-syslib module, but it does | > support what other people have

Re: can list comprehensions replace map?

2005-07-29 Thread Peter Otten
Andrew Dalke wrote: > Steven Bethard wrote: >> Here's one possible solution: >> >> py> import itertools as it >> py> def zipfill(*lists): >> ... max_len = max(len(lst) for lst in lists) > > A limitation to this is the need to iterate over the > lists twice, which might not be possible if one of

Re: how to append cgi FieldStorage Class instance

2005-07-29 Thread Fuzzyman
praba kar wrote: > Dear All, > I have doubt in python cgi script. I describe > that doubt with below code > import cgi > form = cgi.FieldStorage() > passwd = form['passwd'].value > print passwd > But Now I want to assign some value to form['passwd'] > field value > form['passwd'] = 'surese' >

Re: Advanced concurrancy

2005-07-29 Thread Peter Tillotson
Cheers Guys, I have come across twisted and used in async code. What i'm really looking for is something that provides concurrency based on CSP or pi calculus. Or something that looks much more like Java's JSR 166 which is now integrated in Tiger. Peter Tillotson wrote: > Hi, > > I'm looking f

Spreadsheet with Python scripting and database interface?

2005-07-29 Thread Wolfgang Keller
Hello, I'm looking for a spreadsheet application (MacOS X prefered, but Windows, Linux ar available as well) with support for Python scripting (third-party "plug-ins" are ok) and a database interface. Applications that I know of (that they exist) are: MS Excel Quattro Lotus OO Calc Gnumeric Kspr

Re: Spreadsheet with Python scripting and database interface?

2005-07-29 Thread has
Wolfgang Keller wrote: > Excel: I know of a module that allows to script Excel in Python from > outside (COM scripting on Windows and Applescript on MacOS are know as > well), but I don't know of any possibility to do Python scripting with > Excel itself? For scripting Mac applications with Pytho

Re: Ten Essential Development Practices

2005-07-29 Thread Steve Holden
Dan Sommers wrote: > On Thu, 28 Jul 2005 15:35:54 -0700, > Robert Kern <[EMAIL PROTECTED]> wrote: > > >>That said, I made a boo-boo. The Zen of Python is really a set of >>design principles (and some of them, like this one, are more >>specifically *language* design principles), not Essential Deve

Re: Advanced concurrancy

2005-07-29 Thread Paul Rubin
Peter Tillotson <[EMAIL PROTECTED]> writes: > I have come across twisted and used in async code. What i'm really > looking for is something that provides concurrency based on CSP or pi > calculus. Or something that looks much more like Java's JSR 166 which > is now integrated in Tiger. Python does

Re: Ten Essential Development Practices

2005-07-29 Thread Michael Hudson
Steve Holden <[EMAIL PROTECTED]> writes: > If I canpoint out the obvious, the output from "import this" *is* > headed "The Zen of Python", so clearly it isn;t intended to be > universal in its applicability. It's also mistitled there, given that it was originally posted as '19 Pythonic Theses' an

Re: how to append cgi FieldStorage Class instance

2005-07-29 Thread Steve Holden
praba kar wrote: > Dear All, > I have doubt in python cgi script. I describe > that doubt with below code > import cgi > form = cgi.FieldStorage() > passwd = form['passwd'].value > print passwd > But Now I want to assign some value to form['passwd'] > field value > form['passwd'] = 'surese' >

Re: Opinions on KYLIX 3 (Delphi 4 Linux)

2005-07-29 Thread Adriaan Renting
I've used Kylix 3 in the past, but would not consider it nowadays, because it's realy behind the times, it can't run on the latest linux versions and does only support Qt 2.7, while Qt4 has just been released. I'm a C++ programmer and loved Borland C++Builder, I was disappointed by how buggy the C+

Re: codecs.getencoder encodes entire string ?

2005-07-29 Thread nicolas_riesch
Thank you very much ! Nicolas -- http://mail.python.org/mailman/listinfo/python-list

Re: Filtering out non-readable characters

2005-07-29 Thread Adriaan Renting
def StripNoPrint(self, S): from string import printable return "".join([ ch for ch in S if ch in printable ]) Adriaan Renting| Email: [EMAIL PROTECTED] ASTRON | Phone: +31 521 595 217 P.O. Box 2 | GSM: +31 6 24 25 17 28 NL-7990 AA Dwingeloo

Re: how to append cgi FieldStorage Class instance

2005-07-29 Thread praba kar
--- Fuzzyman <[EMAIL PROTECTED]> wrote: > > praba kar wrote: > > Dear All, > > I have doubt in python cgi script. I describe > > that doubt with below code > > import cgi > > form = cgi.FieldStorage() > > passwd = form['passwd'].value > > print passwd > > But Now I want to assign some value

Re: how to append cgi FieldStorage Class instance

2005-07-29 Thread Fuzzyman
praba kar wrote: > --- Fuzzyman <[EMAIL PROTECTED]> wrote: > > > > > praba kar wrote: > > > Dear All, > > > I have doubt in python cgi script. I describe > > > that doubt with below code > > > import cgi > > > form = cgi.FieldStorage() > > > passwd = form['passwd'].value > > > print passwd > >

Filtering terminal commands on linux

2005-07-29 Thread Adriaan Renting
I have the problem that I need to interact with a CD/DVD burning program called gear. I do this by running it in a pseudo terminal. I also need to log what I'm doing, so I copy all output I get from gear to a logfile. The problem is that gear uses terminal control commands to create a nice command

Re: Ten Essential Development Practices

2005-07-29 Thread Dan Sommers
On Fri, 29 Jul 2005 10:08:15 +0100, Steve Holden <[EMAIL PROTECTED]> wrote: > If I canpoint out the obvious, the output from "import this" *is* > headed "The Zen of Python", so clearly it isn;t intended to be > universal in its applicability. Ok, not universal. But as usual, Zen is not easily na

Re: functions without parentheses

2005-07-29 Thread Steven D'Aprano
On Fri, 29 Jul 2005 06:37:52 +, Bengt Richter wrote: > I suggested in a previous thread that one could support such a syntax by > supporting an invisible binary operator between two expressions, so that > examine "string" translates to examine.__invisbinop__("string") if > examine as an expres

Re: To thread or not to thread

2005-07-29 Thread Fuzzyman
Some people are of the opinion that threads are evil. Best Regards, Fuzzy http://www.voidspace.org.uk/python -- http://mail.python.org/mailman/listinfo/python-list

Re: Ten Essential Development Practices

2005-07-29 Thread Paolino
[EMAIL PROTECTED] wrote: > The following url points to an article written by Damian Conway > entitled "Ten Essential Development Practices": > http://www.perl.com/pub/a/2005/07/14/bestpractices.html > > Althought the article has Perl as a focus, I thought that some of the > general points made mig

Re: pySerial Windows write problem

2005-07-29 Thread Neil Benn
Bob Greschke wrote: >"Peter Hansen" <[EMAIL PROTECTED]> wrote in message > > > >>Actually, I'm curious why you don't do the same. I'd call it very unusual >>(in my experience) to have a program open and close a serial port >>repeatedly. Among other things, this means that the DSR/DTR lines a

Re: [path-PEP] Path inherits from basestring again

2005-07-29 Thread Peter Hansen
Tony Meyer wrote: > Would you really choose this: > p = Path() / "build" / "a" / "very" / "very" / "long" / "path" > > Over this: > p = Path(os.path.join("build", "a", "very", "very", "long", "path")) I'd choose neither, because both are contrived examples (who builds paths out of six li

Re: os._exit vs. sys.exit

2005-07-29 Thread Peter Hansen
Andrew Dalke wrote: > sys.exit() is identical to "raise SystemExit()". It raises a Python > exception which may be caught at a higher level in the program stack. And which *is* caught at the highest levels of threading.Thread objects (which Timer is based on). Exceptions raised (and caught or n

Re: pySerial Windows write problem

2005-07-29 Thread Peter Hansen
Bob Greschke wrote: > "Peter Hansen" <[EMAIL PROTECTED]> wrote in message > >>I'd call it very unusual >>(in my experience) to have a program open and close a serial port >>repeatedly. > > One of the serial ports (there are actually two) is used to read some NMEA > sentences from a GPS. It i

Re: os._exit vs. sys.exit

2005-07-29 Thread Bryan
"Peter Hansen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Andrew Dalke wrote: >> sys.exit() is identical to "raise SystemExit()". It raises a Python >> exception which may be caught at a higher level in the program stack. > > And which *is* caught at the highest levels of thre

writing a web client

2005-07-29 Thread Ajar
I want to write a program which will automatically login to my ISPs website, retrieve data and do some processing. Can this be done? Can you point me to any example python programs which do similar things? Regards, Ajar -- http://mail.python.org/mailman/listinfo/python-list

Async PySerial (was Re: pySerial Windows write problem)

2005-07-29 Thread Peter Hansen
Neil Benn wrote: > PySerial doesn;t have any kind of event firing to notify you when data > is available. The way I get round this is to have a loop polling (in a > seperate thread) to see if any data is available (it's a method on the > interface), then read all the data in and fire this off t

Re: os._exit vs. sys.exit

2005-07-29 Thread Peter Hansen
Bryan wrote: > Thanks for the clarifications. One more question, can I catch this > exception in my main thread and then do another sys.exit() to kill the whole > process? Not as such. Exceptions can be caught only in the thread in which they are raised. There are tricky techniques to change

Re: writing a web client

2005-07-29 Thread Fuzzyman
Ajar wrote: > I want to write a program which will automatically login to my ISPs > website, retrieve data and do some processing. Can this be done? Can > you point me to any example python programs which do similar things? > > Regards, > Ajar Very easily. Have a look at my article on the ``urlli

Re: Async PySerial (was Re: pySerial Windows write problem)

2005-07-29 Thread phil
I use PySerial in a 16 line data collection system with LOTS of threads, and yes am frustrated by read(). This sounds excellent, keep us updated. BTW, haven't done any event driven Python except Tkinter. Would this a class library which would let you define an event and a handler? Do you have a

Re: why functions in modules need 'global foo' for integer foo but not dictionary foo?

2005-07-29 Thread John Roth
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > At top of a module I have an integer like so... > > foo = 4 > > In a function in that module I know I need to do 'global foo' to get at > the value 4. Actually, you don't need a "global foo" statement to _access_ the value. You do need

ANN: python-ldap-2.0.9

2005-07-29 Thread Michael Ströder
Find a new release of python-ldap: http://python-ldap.sourceforge.net/ python-ldap provides an object-oriented API to access LDAP directory servers from Python programs. It mainly wraps the OpenLDAP 2.x libs for that purpose. Additionally it contains modules for other LDAP-related stuff (e.g. p

Re: writing a web client

2005-07-29 Thread gene tani
fuzzy's urllib2 info is excellent. The other way peopel snarf stuff over HTTP and FTP is using 'wget' or 'libcurl'. THere's http://pycurl.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: functions without parentheses

2005-07-29 Thread Josef Meile
Steven D'Aprano wrote: > On Fri, 29 Jul 2005 06:37:52 +, Bengt Richter wrote: > > >>I suggested in a previous thread that one could support such a syntax by >>supporting an invisible binary operator between two expressions, so that >>examine "string" translates to examine.__invisbinop__("stri

Re: Friend wants to learn python

2005-07-29 Thread Ron Stephens
EnderLocke wrote: > I have a friend who wants to learn python programming. I learned off > the internet and have never used a book to learn it. What books do you > recommend? > > Any suggestions would be appreciated. I have just uploaded a podcast specifically about which tutorials and books might

Re: Filtering out non-readable characters

2005-07-29 Thread Steve Holden
Adriaan Renting wrote: > def StripNoPrint(self, S): > from string import printable > return "".join([ ch for ch in S if ch in printable ]) > > > Adriaan Renting| Email: [EMAIL PROTECTED] > ASTRON | Phone: +31 521 595 217 > P.O. Box 2 | GSM: +3

Re: Ten Essential Development Practices

2005-07-29 Thread Tim Peters
[Steve Holden] >> If I canpoint out the obvious, the output from "import this" *is* >> headed "The Zen of Python", so clearly it isn;t intended to be >> universal in its applicability. [Michael Hudson] > It's also mistitled there, given that it was originally posted as '19 > Pythonic Theses' and n

Re: poplib.POP3.list() returns extra value?

2005-07-29 Thread Steve Greenland
According to Jeff Epler <[EMAIL PROTECTED]>: > I'd consider it a doc bug too. If you feel comfortable doing it, dive > in and improve the documentation of poplib. Submitting a patch to the > patch tracker on sf.net/projects/python is probably the best way to do > this, if you have the necessary

Re: Ten Essential Development Practices

2005-07-29 Thread Tim Peters
[Dan Sommers] > Ok, not universal. But as usual, Zen is not easily nailed to a tree. > > Was Tim writing about developing Python itself, or about developing > other programs with Python? Tim was channeling Guido, and that's as far as our certain knowledge can go. It _seems_ reasonable to believ

Re: On fighting fire with fire...

2005-07-29 Thread Rocco Moretti
Asad Habib wrote: > Well, even if you are a hobbyist, that does not excuse you from being > civil. After all, we are all humans beings that deserve to be treated with > respect. Professional, hobbyist, vagabond, ogre, instigator, troll ... > THERE IS NO EXCUSE ... please treat others with respect.

Re: Ten Essential Development Practices

2005-07-29 Thread Aahz
In article <[EMAIL PROTECTED]>, Dan Sommers <[EMAIL PROTECTED]> wrote: > >Was Tim writing about developing Python itself, or about developing >other programs with Python? Yes. (C'mon, didja really expect any other answer?) -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft

Re: Ten Essential Development Practices

2005-07-29 Thread Bill Mill
> although, as some argue, it's > possible [GvR] thinks in base 9.5, that just doesn't seem Pythonic to me. +1 QOTW Peace Bill Mill [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Ten Essential Development Practices

2005-07-29 Thread Dark Cowherd
I am new to Python. I tried it out and think it is fantastic. I really loved this from import this statements: There should be one-- and preferably only one --obvious way to do it. But this not true of Python. GUI, Web development, Application Framework - it is shambles. It is so frustrating fo

Re: Ten Essential Development Practices

2005-07-29 Thread Michael Hoffman
Dark Cowherd wrote: > GUI, Web development, Application Framework - it is shambles. Yeah, I agree. When I finally make that GUI application I still don't know whether I am going to use wx or PyGTK. > Is there some place to discuss topics like this? Is this the right place? Sure, although you m

Re: can list comprehensions replace map?

2005-07-29 Thread Andrew Dalke
Peter Otten wrote: > Combining your "clever" and your "elegant" approach to something fast > (though I'm not entirely confident it's correct): > > def fillzip(*seqs): > def done_iter(done=[len(seqs)]): > done[0] -= 1 > if not done[0]: > return > while 1: >

Re: Ten Essential Development Practices

2005-07-29 Thread Daniel Dittmar
Dark Cowherd wrote: > There should be one-- and preferably only one --obvious way to do it. > > But this not true of Python. > GUI, Web development, Application Framework - it is shambles. It is so That's because there is no *obvious* way to do these. > -Quote - Phillip J. Eby from dirtsimple.o

Wheel-reinvention with Python (was: Ten Essential Development Practices)

2005-07-29 Thread Torsten Bronger
Hallöchen! Michael Hoffman <[EMAIL PROTECTED]> writes: > Dark Cowherd wrote: > >> GUI, Web development, Application Framework - it is shambles. > > Yeah, I agree. When I finally make that GUI application I still > don't know whether I am going to use wx or PyGTK. I agree, too, although I can onl

Re: On fighting fire with fire...

2005-07-29 Thread Dr. Who
I was explaining the difference between irony and sarcasm to my daughter just the other day. It was nice of Asad to provide us with such a besutiful example. Not that I'm sure that was his intent... Jeff -- http://mail.python.org/mailman/listinfo/python-list

Re: multiple inheritance super()

2005-07-29 Thread Michele Simionato
Sion Arrowsmith > That way lies Java well, no, a dynamic language such as Python with the possibility of adding methods on the fly and metaclasses could live pretty well without multiple inheritance. There would be no real loss of power and hopefully less monstruosities such a Zope 2. But maybe th

Re: Wheel-reinvention with Python

2005-07-29 Thread Michael Hoffman
Torsten Bronger wrote: > Hallöchen! > > Michael Hoffman <[EMAIL PROTECTED]> writes: > > >>Dark Cowherd wrote: >> >> >>>GUI, Web development, Application Framework - it is shambles. >> >>Yeah, I agree. When I finally make that GUI application I still >>don't know whether I am going to use wx or P

Re: Wheel-reinvention with Python (was: Ten Essential Development Practices)

2005-07-29 Thread Calvin Spealman
The choice is GUI toolkits is largely seperate from Python. Consider that they are just bindings to libraries that are developed completely seperate of the language. GUI is should be seperate from the language, and thus not bound to same expectations and desires as elements of the language itself.

Re: Ten Essential Development Practices

2005-07-29 Thread Calvin Spealman
On 7/29/05, Dark Cowherd <[EMAIL PROTECTED]> wrote: > I am new to Python. I tried it out and think it is fantastic. Congrats and have fun learning all there is to learn. > I really loved this from import this statements: > > There should be one-- and preferably only one --obvious way to do it. >

Re: can list comprehensions replace map?

2005-07-29 Thread Scott David Daniels
Peter Otten wrote: > def fillzip(*seqs): > def done_iter(done=[len(seqs)]): > done[0] -= 1 > if not done[0]: > return > while 1: > yield None > seqs = [chain(seq, done_iter()) for seq in seqs] > return izip(*seqs) Can I play too? How abou

Re: Wheel-reinvention with Python (was: Ten Essential Development Practices)

2005-07-29 Thread Jeremy Moles
On Fri, 2005-07-29 at 17:59 +0200, Torsten Bronger wrote: > Hallöchen! > > Michael Hoffman <[EMAIL PROTECTED]> writes: > > > Dark Cowherd wrote: > > > >> GUI, Web development, Application Framework - it is shambles. > > > > Yeah, I agree. When I finally make that GUI application I still > > don't

Re: can list comprehensions replace map?

2005-07-29 Thread Peter Otten
Andrew Dalke wrote: > Peter Otten wrote: >> Combining your "clever" and your "elegant" approach to something fast >> (though I'm not entirely confident it's correct): >> >> def fillzip(*seqs): >> def done_iter(done=[len(seqs)]): >> done[0] -= 1 >> if not done[0]: >>

Re: Ten Essential Development Practices

2005-07-29 Thread Jorge Godoy
Michael Hoffman wrote: > He spends so much space on "Create Consistent Command-Line Interfaces," > a section that, in Python, could be replaced with a simple "Use optparse." In Perl there's also the equivalent of optparse, but where does it guarantee that you'll use consistent name options and de

Re: Wheel-reinvention with Python (was: Ten Essential Development Practices)

2005-07-29 Thread Jorge Godoy
Jeremy Moles wrote: > Four? > > 1. wx > 2. PyGTK > 3. Tk (Are you including this one even?) > 4. ??? PyQt / PyKDE. > Of the few I can think of, only one would qualify as great. :) The fourth one? ;-) -- Jorge Godoy <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-

Re: Ten Essential Development Practices

2005-07-29 Thread Dan Sommers
On 29 Jul 2005 07:45:33 -0700, [EMAIL PROTECTED] (Aahz) wrote: > In article <[EMAIL PROTECTED]>, > Dan Sommers <[EMAIL PROTECTED]> wrote: >> >> Was Tim writing about developing Python itself, or about developing >> other programs with Python? > Yes. > (C'mon, didja really expect any other answ

Re: Wheel-reinvention with Python (was: Ten Essential Development Practices)

2005-07-29 Thread Jeremy Moles
On Fri, 2005-07-29 at 14:19 -0300, Jorge Godoy wrote: > Jeremy Moles wrote: > > > Four? > > > > 1. wx > > 2. PyGTK > > 3. Tk (Are you including this one even?) > > 4. ??? > > PyQt / PyKDE. Ah! Can't believe I forgot that one! :) > > Of the few I can think of, only one would qualify as great. :

Re: Wheel-reinvention with Python (was: Ten Essential DevelopmentPractices)

2005-07-29 Thread en.karpachov
On Fri, Jul 29, 2005 at 01:18:10PM -0400, Jeremy Moles wrote: > On Fri, 2005-07-29 at 17:59 +0200, Torsten Bronger wrote: > > one thinks "well, perfect, I have the choice between four > > Four? > > 1. wx > 2. PyGTK > 3. Tk (Are you including this one even?) > 4. ??? Well, QT at least. And sure

Re: Ten Essential Development Practices

2005-07-29 Thread Michael Hoffman
Jorge Godoy wrote: > Michael Hoffman wrote: > > >>He spends so much space on "Create Consistent Command-Line Interfaces," >>a section that, in Python, could be replaced with a simple "Use optparse." > > > In Perl there's also the equivalent of optparse, but where does it guarantee > that you'll

Re: writing a web client

2005-07-29 Thread Jay
thats pretty cool, could someone post a example program of a python web-based program? -- http://mail.python.org/mailman/listinfo/python-list

Re: writing a web client

2005-07-29 Thread Jay
thats pretty cool, could someone post a example program of a python web-based program? -- http://mail.python.org/mailman/listinfo/python-list

Hiding

2005-07-29 Thread Jay
Well, im not no expert on the python programming language but i just wanted to know if there was a quick way to hide certain things when programming in python. Such as, i wanted some music or sound effects with my python program. So, i type... print "Music is by blah blah" music-file = open(file c

Re: can list comprehensions replace map?

2005-07-29 Thread Andrew Dalke
Me: >> Could make it one line shorter with > >> from itertools import chain, izip, repeat >> def fillzip(*seqs): >> def done_iter(done=[len(seqs)]): >> done[0] -= 1 >> if not done[0]: >> return [] >> return repeat(None) >> seqs = [chain(seq, done_iter()

Re: can list comprehensions replace map?

2005-07-29 Thread Andrew Dalke
Scott David Daniels wrote: > Can I play too? How about: Sweet! Andrew [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Dr. Dobb's Python-URL! - weekly Python news and links (Jul 29)

2005-07-29 Thread Simon Brunning
QOTW: "Guido has marked the trail; don't ignore the signs unless you really know where you're going." - Raymond Hettinger 'Proverbs 28:14 JPS "Happy is the man that feareth alway; but he that hardeneth his heart shall fall into evil." Obviously an exhortation to not ignore raised exceptions with "

Re: can list comprehensions replace map?

2005-07-29 Thread Peter Otten
Andrew Dalke wrote: > Me: >>> Could make it one line shorter with >> >>> from itertools import chain, izip, repeat >>> def fillzip(*seqs): >>> def done_iter(done=[len(seqs)]): >>> done[0] -= 1 >>> if not done[0]: >>> return [] >>> return repeat(None) >>>

Re: can list comprehensions replace map?

2005-07-29 Thread Peter Otten
Scott David Daniels wrote: > Can I play too? Not unless you buy the expensive but good-looking c.l.py gaming license which is only available trough me :) > How about: > import itertools > > def fillzip(*seqs): > def Nones(countactive=[len(seqs)]): > countactive

Seeking Python expertise...

2005-07-29 Thread Amanda Arnett
Hi, I found out about your Python community and thought you may be able to help me out.  I am supporting an elite group of traders (more like the Who's Who on Wall Street).  We are building algorithmic trading models to analyze market movements, economic indicators, and various factors to pre

Re: Hiding

2005-07-29 Thread Jason Drew
Well, using the open function in Python doesn't launch any application associated with the file (such as Media Player). It just makes the contents of the file accessible to your Python code. Also, I think using file("C:\file.txt") is now preferred to open("C:\file.txt"). To answer the specific que

Re: Hiding

2005-07-29 Thread Larry Bates
I can say with some certainty that opening a "music file" with open won't launch media player. If rather, you do os.system('musicfile.mp3') it will launch whatever application is associated with the file type .mp3. You can either automate Windows Media player or use pymedia to play such files. H

Re: Filtering terminal commands on linux

2005-07-29 Thread Lonnie Princehouse
Firstly, there's probably a better way to do whatever you're trying to do w.r.t cd/dvd burning. I'm not familiar with gear, but its webpage lists "Batch file scripting capability" as a feature, which suggests that you might be able to do what you want without parsing output intended for humans. T

Help with Asyncore

2005-07-29 Thread Seth Nielson
Hello, I am using Asyncore.dispatcher around a socket (well call the wrapped version a channel). This channel is passed around to other objects. These objects call "send" on the channel. My question is, what do you do for "writable" and "handle_write"? Those seemed designed for channel-internal b

Re: Ten Essential Development Practices

2005-07-29 Thread Jorge Godoy
Michael Hoffman wrote: > True, but a lot of his point *is* parsing input from the command line. > Consider the following points paraphrased from his article: > > * Don't mix multiple ways of specifying options. (Solved by optparse) > * If a flag expects an associated value, allow an optional = be

Re: Filtering out non-readable characters

2005-07-29 Thread Steven Bethard
Steve Holden wrote: > >>> tt = "".join([chr(i) for i in range(256)]) Or: tt = string.maketrans('', '') STeVe -- http://mail.python.org/mailman/listinfo/python-list

Re: Hiding

2005-07-29 Thread Steven Bethard
Jason Drew wrote: > Also, I think using file("C:\file.txt") is now preferred > to open("C:\file.txt"). Guido has said he wants to keep open() around as the way to open a file-like object, with the theory that in the future open might also support opening non-files (e.g. urls). So open("C:\file.

Re: Hiding

2005-07-29 Thread Benji York
Steven Bethard wrote: > So open("C:\file.txt") is still fine I think it is more like it is recommended, not just OK. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP on path module for standard library

2005-07-29 Thread Mike Orr
Michael Hoffman wrote: > I use path in more of my modules and scripts than any other third-party > module, and I know it will be very helpful when I no longer have to > worry about deploying it. Same here. An object-oriented path module is extremely useful, and makes one's code much less cluttere

Re: Adding code and methods to a class dynamically

2005-07-29 Thread Sarir Khamsi
Peter Hansen <[EMAIL PROTECTED]> writes: > I'm not sure what "completion" means in this case, and I'm not aware > of any "command-line completion" support in cmd.Cmd though it may well > be there, so I can't say. Certainly there is nothing in any way > different about the new attribute created by

Re: Advanced concurrancy

2005-07-29 Thread Michael Sparks
Peter Tillotson wrote: > Hi, > > I'm looking for an advanced concurrency module for python and don't seem > to be able to find anything suitable. Does anyone know where I might > find one? I know that there is CSP like functionality built into > Stackless but i'd like students to be able to use a

Re: Ten Essential Development Practices

2005-07-29 Thread Peter Hansen
Dan Sommers wrote: > [EMAIL PROTECTED] (Aahz) wrote: >>Dan Sommers <[EMAIL PROTECTED]> wrote: >>>Was Tim writing about developing Python itself, or about developing >>>other programs with Python? > >>Yes. > > It was a rhetorical question. :-) That's all right... Aahz gave a rhetorical answer.

Re: Hiding

2005-07-29 Thread Peter Hansen
Jason Drew wrote: > Also, I think > using file("C:\file.txt") is now preferred to open("C:\file.txt"). As others have noted, "open" is preferred as the method for opening files, while "file" is the _type_ involved, for testing or subclassing or what-have-you. But neither file("C:\file.txt") nor

Re: Adding code and methods to a class dynamically

2005-07-29 Thread Peter Hansen
Sarir Khamsi wrote: > Peter Hansen <[EMAIL PROTECTED]> writes: >>I'm not sure what "completion" means in this case, and I'm not aware >>of any "command-line completion" support in cmd.Cmd though it may well >>be there, so I can't say. Certainly there is nothing in any way >>different about the new

Re: writing a web client

2005-07-29 Thread Mike Meyer
"Fuzzyman" <[EMAIL PROTECTED]> writes: > Ajar wrote: >> I want to write a program which will automatically login to my ISPs >> website, retrieve data and do some processing. Can this be done? Can >> you point me to any example python programs which do similar things? >> >> Regards, >> Ajar > > Ver

Re: can list comprehensions replace map?

2005-07-29 Thread Andrew Dalke
Peter Otten wrote: > Seems my description didn't convince you. So here's an example: Got it. In my test case the longest element happened to be the last one, which is why it didn't catch the problem. Thanks. Andrew [EMAIL PROTECTED

Re: multiple inheritance super()

2005-07-29 Thread Mike Meyer
"Michele Simionato" <[EMAIL PROTECTED]> writes: > adding methods on the fly and metaclasses could live pretty well > without > multiple inheritance. There would be no real loss > of power and hopefully less monstruosities such > a Zope 2. But maybe this is just wishful thinking ... Um, no real lo

Re: Async PySerial (was Re: pySerial Windows write problem)

2005-07-29 Thread Peter Hansen
phil wrote: > I use PySerial in a 16 line data collection system > with LOTS of threads, and yes am frustrated by read(). > This sounds excellent, keep us updated. > > BTW, haven't done any event driven Python except Tkinter. > Would this a class library which would let you > define an event and

A replacement for lambda

2005-07-29 Thread Mike Meyer
I know, lambda bashing (and defending) in the group is one of the most popular ways to avoid writing code. However, while staring at some Oz code, I noticed a feature that would seem to make both groups happy - if we can figure out how to avoid the ugly syntax. This proposal does away with the wel

Block-structured resource handling via decorators

2005-07-29 Thread John Perks and Sarah Mount
When handling resources in Python, where the scope of the resource is known, there seem to be two schools of thought: (1) Explicit: f = open(fname) try: # ... finally: f.close() (2) Implicit: let the GC handle it. I've come up with a third method that uses decorators to achieve a useful

urllib2 bug?

2005-07-29 Thread bob sacamano
Certain pages cause urllib2 to go into an infinite loop when using readline(), but everything works fine if read() is used instead. Is this a bug or am I missing something simple? import urllib2 url = 'http://www.naylamp.com' f = urllib2.urlopen(url) i = 0 #this works fine when uncommented #pr

Re: On fighting fire with fire...

2005-07-29 Thread Steven D'Aprano
On Thu, 28 Jul 2005 15:23:46 -0500, Rocco Moretti wrote: > Professionals (and even decent hobbyists) don't > escalate flame wars, even unintentionally. You don't get out much, do you? *wink* If your comment is meant to be _prescriptive_ rather than _descriptive_, I don't entirely agree. Flame

Re: On fighting fire with fire...

2005-07-29 Thread Steven D'Aprano
On Thu, 28 Jul 2005 17:24:06 -0400, Asad Habib wrote: > Well, even if you are a hobbyist, that does not excuse you from being > civil. After all, we are all humans beings that deserve to be treated with > respect. Professional, hobbyist, vagabond, ogre, instigator, troll ... > THERE IS NO EXCUSE .

Re: Suggestions for Python XML library which can search and insert

2005-07-29 Thread uche . ogbuji
"I'm looking for a library that can search through an XML document tree, locate an element by attribute (ideally this can be done through XPath), and insert an element (as its child). Simple? Yes? ...but the code I've seen so far which does this uses 'nested for loops' for trees which are relative

Re: xml-object mapping

2005-07-29 Thread uche . ogbuji
"I am looking for an xml-object mapping tool ('XML Data Binding-design time product') where I can define the mapping rules in 'binding files' and the parser is generated automatically. Similar to the solution of Dave Kuhlman (http://www.rexx.com/~dkuhlman/ generateDS.html) where the mapping is def

Re: Block-structured resource handling via decorators

2005-07-29 Thread Neil Hodgson
John Perks: > When handling resources in Python, where the scope of the resource is > known, there seem to be two schools of thought: > ... This is part of what PEP 343 addresses: http://www.python.org/peps/pep-0343.html Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Path inherits from basestring again

2005-07-29 Thread NickC
[Re: alternatives to overloading '/'] Is there a reason the Path constructor is limited to a single argument? If it allowed multiple arguments, the following would seem very straightforward: p = Path(somePath, user.getFolder(), 'archive', oldPath + ".bak") I'm usually not much of a purist, but C

Re: Block-structured resource handling via decorators

2005-07-29 Thread Mike Meyer
"John Perks and Sarah Mount" <[EMAIL PROTECTED]> writes: > When handling resources in Python, where the scope of the resource is > known, there seem to be two schools of thought: > > (1) Explicit: > f = open(fname) > try: > # ... > finally: > f.close() > > (2) Implicit: let the GC handle i

Re: Block-structured resource handling via decorators

2005-07-29 Thread Paul Rubin
Mike Meyer <[EMAIL PROTECTED]> writes: > > When handling resources in Python, where the scope of the resource is > > known, there seem to be two schools of thought: > > (1) Explicit: ... > > (2) Implicit: let the GC handle it. > > The only cases I see the first school of thought is when the resour

  1   2   >