The Python world tries to be polite [formerly offensive to another language]

2006-09-29 Thread Steve Holden
Istvan Albert wrote: [...] > ps. as for the title of this post, it is ironic that you are insulting > another community while asking for no insults > Perhaps so, but none the less comp.lang.perl has a demonstrable history of newbie-flaming. Don't know what it's like now, as it's years since I re

Re: Python/UNO/OpenOffice?

2006-09-29 Thread gregarican
That's what I would imagine. Kind of like calling some Microsoft Office COM/OLE methods in a wrapper. As long as the wrapper has most of the methods you need and the core COM/OLE calls don't change then that's a great start. Gary Herron wrote: > [EMAIL PROTECTED] wrote: > > Are then any currently

Re: Python/UNO/OpenOffice?

2006-09-29 Thread Gary Herron
[EMAIL PROTECTED] wrote: > Are then any currently active and reasonably mature Python plugins/ > apis/whatever for programming/scripting OpenOffice? The page I've > found is http://udk.openoffice.org/python/python-bridge.html, but > it was last updated more than a year ago. > > Thanks, > Ken > I

Re: Python/UNO/OpenOffice?

2006-09-29 Thread gregarican
Just because the last code update was a little over a year ago doesn't mean the UNO project is dead. If the OpenOffice API has remained basically the same since UNO was last updated and the Python wrappers are relatively comprehensive then it should fit the bill. Googling around the UNO project was

Python/UNO/OpenOffice?

2006-09-29 Thread kenneth . m . mcdonald
Are then any currently active and reasonably mature Python plugins/ apis/whatever for programming/scripting OpenOffice? The page I've found is http://udk.openoffice.org/python/python-bridge.html, but it was last updated more than a year ago. Thanks, Ken -- http://mail.python.org/mailman/listinfo/

Re: Talking to marketing people about Python

2006-09-29 Thread gregarican
Lots of folks have pointed out large scale Python success stories ranging from NASA to Google to Amazon. Such companies should make for good PHB fodder in your argument. Most likely if the product manager is just a drone you can throw in some other acceptable norm. Since IronPython and Microsoft's

Re: DAT file compilation

2006-09-29 Thread James Stroud
Jay wrote: > That cgi idea is really cool, but I don't have any web space to host > the files. Plus the bandwidth required would be deadly. I think you are overestimating the cost of bandwidth. By the time it becomes an issue, you've sold so many units of software, and people are using your pr

Re: another distutils question

2006-09-29 Thread Eric S. Johansson
Robert Kern wrote: > Instead, include the default data inside the package (read-only to non-root > users). Then allow the script itself to create the directory the first time > it > is run (read-write, and it should then automatically be accessible to the > user > that ran the script). You mi

Re: Block Diagram / digraph Editor

2006-09-29 Thread Nick Vatamaniuc
I was trying to create a small graph editor a while ago and was looking for a similar thing. I found the diacanvas project (http://diacanvas.sourceforge.net/) that does some of these things you mentioned but for me it wasn't mature enough back then. Then, I eventually settled on using the standar

Re: another distutils question

2006-09-29 Thread Eric S. Johansson
Keith Perkins wrote: > > On a similar note , I have another question about distutils and data files. > I have a little program that uses a txt file to store data, and it works > fine running it in it's own folder, if I install through distutils, using > sudo to get it to write to the site-packages

MySQLdb for Python 2.5

2006-09-29 Thread Harold Trammel
Hi everyone, Does anyone know the status of a version of MySQLdb that will work with Python 2.5? I will accept a workaround if you know one. Thanks in advance. Harold Trammel -- http://mail.python.org/mailman/listinfo/python-list

Re: DAT file compilation

2006-09-29 Thread Nick Vatamaniuc
You can always use pickle. Have a script that reads your folder with the media, insert the images and sounds into arrays or your own special classes then use pickle to dump them to a .dat file. The user gets just one .dat file. When your program runs, it reads the object with the data from the dis

Re: another distutils question

2006-09-29 Thread Robert Kern
Keith Perkins wrote: > I did install it in ~/.script/data.txt, and distutils set the > user/group as root. Is it impossible to install this with distutils? > Since I'm running setup as root, should I just add a class or method to > chown the datafolder/file to the installer. Should I use autotool

Re: Automatic methods in new-style classes

2006-09-29 Thread George Sakkis
Ben Cartwright wrote: > [EMAIL PROTECTED] wrote: > > Hey, I have the following code that has to send every command it > > receives to a list of backends. > > > I would like to write each method like: > > > > flush = multimethod() > > Here's one way, using a metaclass: Or if you don't mind a

Re: another distutils question

2006-09-29 Thread Keith Perkins
On Fri, 29 Sep 2006 18:57:12 -0500, Robert Kern wrote: > Keith Perkins wrote: > >> On a similar note , I have another question about distutils and data files. >> I have a little program that uses a txt file to store data, and it works >> fine running it in it's own folder, if I install through di

Re: analyzing removable media

2006-09-29 Thread glenn
Nick Vatamaniuc wrote: > glenn wrote: > > Hi > > can anyone tell me how given a directory or file path, I can > > pythonically tell if that item is on 'removable media', or sometype of > > vfs, the label of the media (or volume) and perhaps any other details > > about the media itself? > > thanks

Re: analyzing removable media

2006-09-29 Thread glenn
> > As soon as you ask for "cross platform" and something that is > device/OS specific... you have conflict. > > From the win32 extensions: > > win32file.GetDriveType > int = GetDriveType() > > Determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, > or network drive. > > R

Re: DAT file compilation

2006-09-29 Thread MonkeeSage
Jay wrote: > Is there a way through python that I can take a few graphics and/or > sounds and combine them into a single .dat file? If so, how? And how > can I access the data in the .dat file from inside the python script? How about in a sqlite database? Sqlite has built-in bindings in python 2

Re: DAT file compilation

2006-09-29 Thread Jay
That cgi idea is really cool, but I don't have any web space to host the files. Plus the bandwidth required would be deadly. I think I'll just have to stick to the zip file idea. The problem with the read-only is that this program is aimed at a Windows audience. James Stroud wrote: > Jay wrote:

Re: DAT file compilation

2006-09-29 Thread James Stroud
Jay wrote: > That's one solution, but I'd rather a file format the end-user can't > easily mess around with. Require the program to be installed as root and installation to be in a read-only directory--or serve the resources to your program from a cgi script somewhere, only to be downloaded when

Re: DAT file compilation

2006-09-29 Thread Jay
That's one solution, but I'd rather a file format the end-user can't easily mess around with. Diez B. Roggisch wrote: > Jay schrieb: > > Is there a way through python that I can take a few graphics and/or > > sounds and combine them into a single .dat file? If so, how? And how > > can I access th

Re: DAT file compilation

2006-09-29 Thread Diez B. Roggisch
Jay schrieb: > Is there a way through python that I can take a few graphics and/or > sounds and combine them into a single .dat file? If so, how? And how > can I access the data in the .dat file from inside the python script? Use a zip-file. See the zipfile-module. Diez -- http://mail.python.o

Re: another distutils question

2006-09-29 Thread Robert Kern
Keith Perkins wrote: > On a similar note , I have another question about distutils and data files. > I have a little program that uses a txt file to store data, and it works > fine running it in it's own folder, if I install through distutils, using > sudo to get it to write to the site-packages f

Re: Talking to marketing people about Python

2006-09-29 Thread Aahz
In article <[EMAIL PROTECTED]>, Magnus Lycka <[EMAIL PROTECTED]> wrote: > >In other words, Python has to a significant taken over the role Perl >had. Perl once succeeded because it was in the right place at the >right time, but it's failed in the long ruin because it can't handle >the complexity o

Re: another distutils question

2006-09-29 Thread Keith Perkins
On Fri, 29 Sep 2006 13:53:46 -0400, Eric S. Johansson wrote: > is there anyway I can, in a setup.py file, set and internal equivalent > to the '--install-scripts' commandline option? > > script installation directory but I don't want on the command line where > things can go horribly wrong if

DAT file compilation

2006-09-29 Thread Jay
Is there a way through python that I can take a few graphics and/or sounds and combine them into a single .dat file? If so, how? And how can I access the data in the .dat file from inside the python script? -- http://mail.python.org/mailman/listinfo/python-list

Re: for: else: - any practical uses for the else clause?

2006-09-29 Thread Paul Rubin
Matthew Woodcraft <[EMAIL PROTECTED]> writes: > How do you transform this? > > height = 0 > for block in stack: > if block.is_marked(): > print "Lowest marked block is at height", height > break > height += block.height > else: > raise SomeError("No marked block") Unte

Block Diagram / digraph Editor

2006-09-29 Thread MakaMaka
Hi, Does anybody know of a good widget for wxpython, gtk, etc. that allows the editing of block diagrams and make it easy to export the diagram as a digraph? It has to be available under Windows. I want the user to draw a series of blocks on a canvas, connect them with directional arrows, and the

Re: Problems wth os.stat().st_mtime on Mac

2006-09-29 Thread Martin v. Löwis
Michael Glassford schrieb: > Although not mentioned in the Python 2.5 News, apparently there was a > similar change on Mac that I'm having some problems with. On the Mac, > just as on Windows, os.stat().st_mtime now returns a float instead of an > integer. It's isn't really new; os.stat_float_time

Re: for: else: - any practical uses for the else clause?

2006-09-29 Thread Matthew Woodcraft
[EMAIL PROTECTED] wrote: > And so on. For every use of the for/else clause there exists a better > alternative. Which sums up my opinion about the construct -- if you > are using it, there's something wrong with your code. How do you transform this? height = 0 for block in stack: if block.is_

Re: creating a small test server on my local computer

2006-09-29 Thread Paul Boddie
Tim Chase wrote: > > Well, you could investigate WebStack: [...] > The documentation is a bit terse, and lacking in some areas, but > a little debugging output goes a long way toward diagnosing > problems with your code. Suggestions for improvement are very welcome! And I do value the expertise

Re: Automatic methods in new-style classes

2006-09-29 Thread Ben Cartwright
[EMAIL PROTECTED] wrote: > Hey, I have the following code that has to send every command it > receives to a list of backends. > I would like to write each method like: > > flush = multimethod() Here's one way, using a metaclass: class multimethod(object): def transform(self, attr):

Re: creating a small test server on my local computer

2006-09-29 Thread Roger Upole
"John Salerno" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Irmen de Jong wrote: >> John Salerno wrote: >>> Ok, this is completely unnecessary so I don't intend to get into stuff >>> that's beyond my skill, but I'm wondering how simple >>> it would be to use Python to create a se

Re: Automatic methods in new-style classes

2006-09-29 Thread Scott David Daniels
Scott David Daniels wrote: > > class Forwards(object): > > to_forward = set(['flush', 'read', 'write', 'close']) > > def __init__(self, backends): > self.backends = backends > > def forwarder(self, methodname): > def method(*args, **kwargs): > for b in se

Re: Automatic methods in new-style classes

2006-09-29 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > Hey, I want to send commands to a list of backends: How about something like: class Forwards(object): to_forward = set(['flush', 'read', 'write', 'close']) def __init__(self, backends): self.backends = backends def forwarder(self, methodname)

Re: for: else: - any practical uses for the else clause?

2006-09-29 Thread BJörn Lindqvist
On 9/29/06, Johan Steyn <[EMAIL PROTECTED]> wrote: > I agree that it is meaningless without a break statement, but I still find > it useful when I want to determine whether I looped over the whole list or > not. For example, if I want to see whether or not a list contains an odd > number: > > for

Re: for: else: - any practical uses for the else clause?

2006-09-29 Thread Mike Klaas
On 9/29/06, Johan Steyn <[EMAIL PROTECTED]> wrote: > On 29 Sep 2006 11:26:10 -0700, Klaas <[EMAIL PROTECTED]> wrote: > > > else: does not trigger when there is no data on which to iterate, but > > when the loop terminated normally (ie., wasn't break-ed out). It is > > meaningless without break. >

Re: for: else: - any practical uses for the else clause?

2006-09-29 Thread Klaas
Klaas wrote: > else: does not trigger when there is no data on which to iterate, but > when the loop terminated normally (ie., wasn't break-ed out). It is > meaningless without break. Sorry, this was worded confusingly. "else: triggers when the loop terminates normally, not simply in the case t

Re: for: else: - any practical uses for the else clause?

2006-09-29 Thread Johan Steyn
On 29 Sep 2006 11:26:10 -0700, Klaas <[EMAIL PROTECTED]> wrote: else: does not trigger when there is no data on which to iterate, butwhen the loop terminated normally (ie., wasn't break-ed out).  It is meaningless without break.  The else clause *is* executed when there is no data on which to itera

Re: analyzing removable media

2006-09-29 Thread Jay
Dennis is absolutely right. The reason you won't find a method in the standard libraries for doing this task specifically is because python aims to by cross-platform. If it were to support a method that worked in the way you describe specifically for Windows, that would essentially break python's

Re: storing variable names in a list before they are used?

2006-09-29 Thread MonkeeSage
John Salerno wrote: > If I want to have a list like this: > > [(first_name, 'First Name:'), (last_name, 'Last Name:').] Do you need the data to be ordered? If not, just use a dictionary: d = {'First Name:': '', 'Last Name:': ''} d['First Name:'] = 'Bob' d['Last Name:'] = 'Smith' print "Hi, I

Re: Automatic methods in new-style classes

2006-09-29 Thread Peter Otten
[EMAIL PROTECTED] wrote: > Hey, I have the following code that has to send every command it > receives to a list of backends. Instead of: > > class MultiBackend(object): > """Renders to multiple backends""" > > def __init__(self, backends): > self.backends = backends > > def

Re: storing variable names in a list before they are used?

2006-09-29 Thread Ant
John Salerno wrote: > If I want to have a list like this: > > [(first_name, 'First Name:'), (last_name, 'Last Name:').] > > where the first part of each tuple is a variable name and the second ... > can't leave them as above, but if I put them in as a string, then how do > I later "transform"

Re: another distutils question

2006-09-29 Thread Eric S. Johansson
Eric S. Johansson wrote: > So what I have seen so far says that to be able to take data from a > series of directories scatter it to other directories may be out of > scope. It's okay. If I have to write a wrapper, it won't be the first > time. do'h. http://docs.python.org/dist/node13.html

Re: Mark Lutz Python interview

2006-09-29 Thread Fuzzyman
Mark Lutz wrote: > Python author and trainer Mark Lutz will be interviewed > on the radio show Tech Talk this Sunday, October 1st, > at 6PM Eastern time. He'll be answering questions about > Python, his books, and his Python training services. > Does he always talk in the third person ? ;-) Fuz

Re: another distutils question

2006-09-29 Thread Eric S. Johansson
Robert Kern wrote: > Eric S. Johansson wrote: > >> Now I get to puzzle out how to install the CGI plus images plus >> stylesheets plus plus plus mess. Probably a bit outside of the scope of >> distutils even if the CGI programs are Python. ;-) > > I recommend installing the data inside the pa

Re: iterator question

2006-09-29 Thread Travis Oliphant
Neal Becker wrote: > Any suggestions for transforming the sequence: > > [1, 2, 3, 4...] > Where 1,2,3.. are it the ith item in an arbitrary sequence > > into a succession of tuples: > > [(1, 2), (3, 4)...] > > In other words, given a seq and an integer that specifies the size of tuple > to retu

Re: storing variable names in a list before they are used?

2006-09-29 Thread jmdeschamps
John Salerno wrote: > If I want to have a list like this: > > [(first_name, 'First Name:'), (last_name, 'Last Name:').] > > where the first part of each tuple is a variable name and the second > part is a label for the user to see, such as a form like this: > > First Name: > Last Name

Re: storing variable names in a list before they are used?

2006-09-29 Thread Farshid Lashkari
Hi John John Salerno wrote: > how would I go about putting these variable names in a list? I know I > can't leave them as above, but if I put them in as a string, then how do > I later "transform" them into an actual variable for assign, such as: > > first_name = widget.get_text() > > Is there

Re: ctypes.c_void_p(-1) might not be C return (void *) -1

2006-09-29 Thread Thomas Heller
[EMAIL PROTECTED] schrieb: >> I've started a wiki page where I already added an entry about the above >> question. >> Do you think the entry would have answered your question? >> http://starship.python.net/crew/theller/moin.cgi/CodeSnippets > > As concise as I now can imagine, yes thank you. > >

Re: another distutils question

2006-09-29 Thread Robert Kern
Eric S. Johansson wrote: > Now I get to puzzle out how to install the CGI plus images plus > stylesheets plus plus plus mess. Probably a bit outside of the scope of > distutils even if the CGI programs are Python. ;-) I recommend installing the data inside the package itself. In 2.4, use the

Addendum (was: creating a small test server on my local computer)

2006-09-29 Thread Mirco Wahab
Thus spoke Mirco Wahab (on 2006-09-29 21:32): > Thus spoke John Salerno (on 2006-09-29 21:13): >> Irmen de Jong wrote: >>> John Salerno wrote: Ok, this is completely unnecessary so I don't intend to get into stuff >>> Why do you need to use Python for the server? >> Well, perhaps I don't know

Re: windev vs python SOS

2006-09-29 Thread jmdeschamps
Bruno Desthuilliers wrote: > [EMAIL PROTECTED] wrote: > > Hi, > > > > Bruno Desthuilliers a écrit : > >> I've never met a programmer that "loved" Windev. > > > > I have met some here (I'm the guy with a mustache-just kidding but > > actually I was there). > > > > http://www.pcsoft.fr/pcsoft/tdftec

storing variable names in a list before they are used?

2006-09-29 Thread John Salerno
If I want to have a list like this: [(first_name, 'First Name:'), (last_name, 'Last Name:').] where the first part of each tuple is a variable name and the second part is a label for the user to see, such as a form like this: First Name: Last Name: (the variables would s

Re: another distutils question

2006-09-29 Thread Eric S. Johansson
Robert Kern wrote: > > Okay, if it's just for internal use, then I certainly have no objection. Use > a > setup.cfg file: > >http://docs.python.org/inst/config-syntax.html > > Specifically, use something like the following section: > > [install] > install_scripts=/path/to/scripts/director

Re: another distutils question

2006-09-29 Thread Robert Kern
Eric S. Johansson wrote: > Robert Kern wrote: >> Eric S. Johansson wrote: >>> is there anyway I can, in a setup.py file, set and internal equivalent >>> to the '--install-scripts' commandline option? >> Please don't. Hard-coding that interferes with the user's decision of where >> things should

Re: creating a small test server on my local computer

2006-09-29 Thread Mirco Wahab
Thus spoke John Salerno (on 2006-09-29 21:13): > Irmen de Jong wrote: >> John Salerno wrote: >>> Ok, this is completely unnecessary so I don't intend to get into stuff >>> that's beyond my skill, but I'm wondering how simple it would be to >>> use Python to create a server that runs on my compute

Re: another distutils question

2006-09-29 Thread Eric S. Johansson
Robert Kern wrote: > Eric S. Johansson wrote: >> is there anyway I can, in a setup.py file, set and internal equivalent >> to the '--install-scripts' commandline option? > > Please don't. Hard-coding that interferes with the user's decision of where > things should go. Only the user should be m

Re: retry in exception

2006-09-29 Thread MonkeeSage
Everyone wrote: > [cool stuff] Ps. I've only used retry a handful of times in about 3 or 4 years of using ruby; I wasn't advocating it or criticizing python, just trying to explain the OPs request. Regards, Jordan -- http://mail.python.org/mailman/listinfo/python-list

Re: creating a small test server on my local computer

2006-09-29 Thread Tim Chase
>> Why do you need to use Python for the server? > > Well, perhaps I don't know what I'm talking about. I'm on an XP machine > and I just needed a way to test my web pages, and I thought Python could > be used to create a server to do this. But I know nothing about network > programming... Wel

Sockets in python

2006-09-29 Thread OneMustFall
Reciently i wrote a simple client (in twisted) using Reconnecting Factory. That client logins to my socket server.. and that`s it. Interesting thing is that it is seems that twisted client, sends some ping on a TCP level without sending any data to the socket directl

Re: How to query a function and get a list of expected parameters?

2006-09-29 Thread George Sakkis
Matthew Wilson wrote: > I'm writing a function that accepts a function as an argument, and I > want to know to all the parameters that this function expects. How can > I find this out in my program, not by reading the source? > > For example, I would want to know for the function below that I hav

Re: retry in exception

2006-09-29 Thread Tim Chase
> In ruby, the equivalent to try...except is begin...rescue. In the > rescue section you can ask it to retry the begin section. So, for > example: > > b=0 > begin > puts 1/b > rescue > b=1 > retry # <- this little guy > end Well, it's all a matter of how you look at it. I personally pref

Re: retry in exception

2006-09-29 Thread Fredrik Lundh
MonkeeSage wrote: > I don't think python has any equivalent (could be wrong). a trivial combination of while and try/except/else does the trick: n = 0 while 1: try: # do something print n n = n + 1 # make sure it fails a couple of times if n < 10:

Re: creating a small test server on my local computer

2006-09-29 Thread John Salerno
Irmen de Jong wrote: > John Salerno wrote: >> Ok, this is completely unnecessary so I don't intend to get into stuff >> that's beyond my skill, but I'm wondering how simple it would be to >> use Python to create a server that runs on my computer so I can test >> my webpages (because otherwise I

PEP proposal : Getting rid of the extension version/compiler dependency

2006-09-29 Thread Steve Menard
It's been observed a couple times recently ... distributing and compiling extensions is a pain, especially on windows, when the main supported compilers are not freely availble .. nor even commercially availble anymore. What we need is a way to break out of this dependency. A way for python ext

Re: How to query a function and get a list of expected parameters?

2006-09-29 Thread Nick Vatamaniuc
Matt, In [26]: inspect.getargspec(f) Out[26]: (['x1', 'x2'], None, None, None) For more see the inspect module. -Nick Vatamaniuc Matthew Wilson wrote: > I'm writing a function that accepts a function as an argument, and I > want to know to all the parameters that this function expects. How c

Re: Can recursive descent parser handle Python grammar?

2006-09-29 Thread Antoon Pardon
On 2006-09-28, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I'm a compiler newbie and was curious if Python's language/grammar > can be handled by a recursive descent parser. IIUC the python grammer is LL(1) and the development team is commited to keeping it LL(1). LL(1) languages can be handle

Re: retry in exception

2006-09-29 Thread Diez B. Roggisch
MonkeeSage schrieb: > Sybren Stuvel wrote: >> Antoine De Groote enlightened us with: >>> I hope I don't upset anybody by comparing Python to Ruby (again). Is >>> there something like Ruby's retry keyword in Python? >> Please don't assume that everybody knows Ruby through and through... > > In ruby

Re: XSLT speed comparisons

2006-09-29 Thread Jordan
If your using python 2.4.3 or essentially any of the 2.3, 2.4 series, i'd test out PyScripter as an IDE, it's one of the best that I've used. Unfortunately, they have yet to fully accomedate 2.5 code (you can still write 2.5 code with almost no problems, but you won't be able to use a 2.5 interact

Re: XSLT speed comparisons

2006-09-29 Thread Jordan
If your using python 2.4.3 or essentially any of the 2.3, 2.4 series, i'd test out PyScripter as an IDE, it's one of the best that I've used. Unfortunately, they have yet to fully accomedate 2.5 code (you can still write 2.5 code with almost no problems, but you won't be able to use a 2.5 interact

Re: There's another Timbot on the loose!

2006-09-29 Thread Carl Friedrich Bolz
Paul Rubin wrote: > http://web.cecs.pdx.edu/~mpj/timbot/index.html How said it's another one? Maybe our timbot grew a body. -- http://mail.python.org/mailman/listinfo/python-list

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Carl Friedrich Bolz
Larry Hastings wrote: [snip] > The core concept: adding two strings together no longer returns a pure > "string" object. Instead, it returns a "string concatenation" object > which holds references to the two strings but does not actually > concatenate > them... yet. The strings are concatenated

Re: another distutils question

2006-09-29 Thread Robert Kern
Eric S. Johansson wrote: > is there anyway I can, in a setup.py file, set and internal equivalent > to the '--install-scripts' commandline option? Please don't. Hard-coding that interferes with the user's decision of where things should go. Only the user should be making that decision, not the

Re: Leave the putdowns in the Perl community, the Python world does not need them

2006-09-29 Thread Istvan Albert
metaperl wrote: > I was shocked to see the personal insults hurled in this thread: > http://groups.google.com/group/comp.lang.python/browse_thread/thread/d0758cb9545cad4b Ahhh, no need to overreact, that's just the usual Friday night steel cage match: Fredrik vs "Poster Who is Convinced That The

Re: creating a small test server on my local computer

2006-09-29 Thread Irmen de Jong
John Salerno wrote: > Ok, this is completely unnecessary so I don't intend to get into stuff > that's beyond my skill, but I'm wondering how simple it would be to use > Python to create a server that runs on my computer so I can test my > webpages (because otherwise I have to keep sending them t

Automatic methods in new-style classes

2006-09-29 Thread bertgoos
Hey, I have the following code that has to send every command it receives to a list of backends. Instead of: class MultiBackend(object): """Renders to multiple backends""" def __init__(self, backends): self.backends = backends def flush(self): for b in self.backends:

Re: retry in exception

2006-09-29 Thread MonkeeSage
Sybren Stuvel wrote: > Antoine De Groote enlightened us with: > > I hope I don't upset anybody by comparing Python to Ruby (again). Is > > there something like Ruby's retry keyword in Python? > > Please don't assume that everybody knows Ruby through and through... In ruby, the equivalent to try...

How to query a function and get a list of expected parameters?

2006-09-29 Thread Matthew Wilson
I'm writing a function that accepts a function as an argument, and I want to know to all the parameters that this function expects. How can I find this out in my program, not by reading the source? For example, I would want to know for the function below that I have to pass in two things: def f(

Re: for: else: - any practical uses for the else clause?

2006-09-29 Thread Klaas
metaperl wrote: > Actually right after posting this I came up with a great usage. I use > meld3 for my Python based dynamic HTML generation. Whenever I plan to > loop over a tree section I use a for loop, but if there is no data to > iterate over, then I simply remove that section from the tree or

Re: Can recursive descent parser handle Python grammar?

2006-09-29 Thread [EMAIL PROTECTED]
Ben Sizer wrote: > [EMAIL PROTECTED] wrote: > > I'm a compiler newbie and was curious if Python's language/grammar > > can be handled by a recursive descent parser. > > I believe a recursive descent parser can handle any grammar; it just > depends on how pure you want it to be. > > -- > Ben Size

Mark Lutz Python interview

2006-09-29 Thread Mark Lutz
Python author and trainer Mark Lutz will be interviewed on the radio show Tech Talk this Sunday, October 1st, at 6PM Eastern time. He'll be answering questions about Python, his books, and his Python training services. For more details about the show, see Tech Talk's website at http://techtalk.im

Re: Passing Arguments

2006-09-29 Thread Tim Chase
> It works fine when I 'Run Module'...but when I type in interactive mode > in the Python Shell python using_sys.py test1 test2 test3 > > I get the following error: > SyntaxError: invalid syntax By using proper syntax... :*) To pass parameters, you do it when *starting* python[*]. Thus,

Passing Arguments

2006-09-29 Thread theemails
New to Python ... this should be an easy question to answer. INPUT import sys print 'The command line arguments are:' for i in sys.argv: print i print '\nThe PYTHONPATH is', sys.path OUTPUT The command line arguments are: C:\Python25\using_sys.py The PYTHONPATH is ['C:\\Python25\\Lib\\idl

Re: Talking to marketing people about Python

2006-09-29 Thread John Salerno
Magnus Lycka wrote: > In other words, Python has to a significant taken over the role Perl > had. This seems relevant to that thought (although it's not working right now): http://suttree.com/2006/09/02/php-is-the-new-classic/ -- http://mail.python.org/mailman/listinfo/python-list

creating a small test server on my local computer

2006-09-29 Thread John Salerno
Ok, this is completely unnecessary so I don't intend to get into stuff that's beyond my skill, but I'm wondering how simple it would be to use Python to create a server that runs on my computer so I can test my webpages (because otherwise I have to keep sending them to our IT person so he can u

another distutils question

2006-09-29 Thread Eric S. Johansson
is there anyway I can, in a setup.py file, set and internal equivalent to the '--install-scripts' commandline option? script installation directory but I don't want on the command line where things can go horribly wrong if the user forgets. I would like to create a new default setting for th

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Larry Hastings
Fredrik Lundh wrote: > so what does the benchmark look like if you actually do this ? Okay, timing this: x = "" for i in range(10): x += "a" t = x[1] # forces the concat object to render The result: Python 2.5 release: 30.0s Python 2.5 locally built: 30.2s Python 2.5 concat: 4

Re: Making sure script only runs once instance at a time.

2006-09-29 Thread Paul Rubin
Fredrik Lundh <[EMAIL PROTECTED]> writes: > opening a file for writing doesn't lock it on Unix. if you want > locking, you need other mechanisms, and I'm not sure any of them > work properly on all configurations, under all circumstances. Hmm. What about trying to listen on a PF_UNIX socket asso

Re: windev vs python SOS

2006-09-29 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > Hi, > > Bruno Desthuilliers a écrit : >> I've never met a programmer that "loved" Windev. > > I have met some here (I'm the guy with a mustache-just kidding but > actually I was there). > > http://www.pcsoft.fr/pcsoft/tdftech/2006/images/Paris/07-IMG_5853.jpg > > WinD

Re: Making sure script only runs once instance at a time.

2006-09-29 Thread Tim Williams
On 29/09/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Tim Williams wrote: > > > So that I know my mistake, which bit fails (the text from > > sys.exc_info()[1]?? ) , or is it all complete rubbish - and not > > do-able - on a *nix system ? > > opening a file for writing doesn't lock it on Unix.

Re: Making sure script only runs once instance at a time.

2006-09-29 Thread Fredrik Lundh
Paul Rubin wrote: >> That's the same kind of principle as my posted snippet, it doesn't >> rely on the file's presence or absence as such. It only cares when >> the file exists *and* is held open by another process.When the >> process exits, the lock ends without needing to clean up. >> >>

Re: Making sure script only runs once instance at a time.

2006-09-29 Thread Tim Williams
On 29 Sep 2006 10:04:15 -0700, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: > "Tim Williams" <[EMAIL PROTECTED]> writes: > > That's the same kind of principle as my posted snippet, it doesn't > > rely on the file's presence or absence as such. It only cares when > > the file exists *and* is

Re: wxPython and threading issue

2006-09-29 Thread [EMAIL PROTECTED]
Patrick Smith wrote: > > Well, the problem is that you can't simply kill a thread--it shares > > memory with other threads that it could be leaving in an inconsistent > > state. Imagine that it was, say, holding a lock when it was forceably > > killed. Now any other thread that tries to acquire t

Re: Making sure script only runs once instance at a time.

2006-09-29 Thread Fredrik Lundh
Tim Williams wrote: > So that I know my mistake, which bit fails (the text from > sys.exc_info()[1]?? ) , or is it all complete rubbish - and not > do-able - on a *nix system ? opening a file for writing doesn't lock it on Unix. if you want locking, you need other mechanisms, and I'm not sure

Re: Making sure script only runs once instance at a time.

2006-09-29 Thread Fredrik Lundh
Paul Rubin wrote: > Don't use the presence or absence of a file as a lock. Have the file > there all the time, and have the app open it and use fcntl to get an > exclusive kernel lock on the file descriptor. doesn't work on all file systems, though... -- http://mail.python.org/mailman/listin

Re: Making sure script only runs once instance at a time.

2006-09-29 Thread Paul Rubin
"Tim Williams" <[EMAIL PROTECTED]> writes: > That's the same kind of principle as my posted snippet, it doesn't > rely on the file's presence or absence as such. It only cares when > the file exists *and* is held open by another process.When the > process exits, the lock ends without needing

Re: Leave the putdowns in the Perl community, the Python world does not need them

2006-09-29 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > Steve makes a good point. Fredrik is one of the most important > contributors of Python code, tools, etc and as far as I am concerned, > that is so important that it gives him the right to be cranky from tiem > to time. Since February last year I've had the opportunity t

Re: Making sure script only runs once instance at a time.

2006-09-29 Thread Tim Williams
On 29 Sep 2006 09:47:12 -0700, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: > "Tim Williams" <[EMAIL PROTECTED]> writes: > > My reply was in response to a post that mentioned a known problem with > > this, what happens when the previously running program doesn't exit > > gracefully, and leav

Re: screen capture

2006-09-29 Thread Fredrik Lundh
titan516 wrote: >> I am trying to use PIL and I saw there is ImageGrab...however it only >> works on Windows. Is there a platform-independent ability to work >> around this? > Maybe you can try http://www.acasystems.com ACA capture PRO , it , i > think,can fix your problem well.. "System re

  1   2   3   >