Re: How to force a thread to stop

2006-07-26 Thread Gerhard Fiedler
On 2006-07-26 19:08:44, Carl J. Van Arsdall wrote: > Also, threading's condition and event constructs are used a lot > (i talk about it somewhere in that thing I wrote). They are easy to use > and nice and ready for me, with a server wouldn't I have to have things > poll/wait for messages? Ho

Re: How to force a thread to stop

2006-07-26 Thread Carl J. Van Arsdall
Gerhard Fiedler wrote: > On 2006-07-26 19:08:44, Carl J. Van Arsdall wrote: > > >> Also, threading's condition and event constructs are used a lot >> (i talk about it somewhere in that thing I wrote). They are easy to use >> and nice and ready for me, with a server wouldn't I have to have thi

Re: list problem

2006-07-26 Thread placid
Thank you all for the replies, i now have a better solution. Cheers -- http://mail.python.org/mailman/listinfo/python-list

Re: a print bug?

2006-07-26 Thread Summercoolness
Sybren Stuvel wrote: > It has nothing to do with the print command, and everything with > floating point precision. See http://docs.python.org/tut/node16.html how about the discrepancy between >>> print 1.2345 1.2345 >>> print "%10.3f" % 1.2345# seems like a bug 1.234 the first one

Re: a print bug?

2006-07-26 Thread Summercoolness
[EMAIL PROTECTED] wrote: > how about the discrepancy between > > >>> print 1.2345 > > 1.2345 > > >>> print "%10.3f" % 1.2345# seems like a bug > > 1.234 > > the first one, print knows enough to recognize and print it as 1.2345. > however, in the second line, when it is round off, it doesn

Re: Nested function scope problem

2006-07-26 Thread danielx
Bruno Desthuilliers wrote: > Gerhard Fiedler wrote: > > On 2006-07-25 04:06:24, Steve Holden wrote: > > > > > >>Dennis Lee Bieber wrote: > >> > >>>On Mon, 24 Jul 2006 17:35:50 -0300, Gerhard Fiedler <[EMAIL PROTECTED]> > >>>declaimed the following in comp.lang.python: > >>> > >>> > It is surpr

SDL doesn't cope well with FreeSans

2006-07-26 Thread Greg Ewing
Whenever I try to use the FreeSans font with SDL, either through PyGame or Soya, I get disappointing results. The characters come out slightly higglety-pigglety -- randomly displaced up or down a pixel or so from the baseline. Something about the calculation of the font height seems to be off, too

Re: why is this not working? (nested scope question)

2006-07-26 Thread John Salerno
[EMAIL PROTECTED] wrote: > I do understand (and verified) that if I define f2 within f1, it works > as expected. But in the "learning pyton 2nd edition" at page 205 it is > said that "Programs are much simpler if you do not nest defs within > defs" (juste before the code mentioned in my initial me

subprocess module

2006-07-26 Thread placid
Hi all, ive been trying to create a thumbnail using the ffmpeg converter running the ffmpeg.exe using the subprocess module with the following code >>> import subprocess >>> p = subprocess.Popen(["ffmpeg.exe -i video.mpg", "-f mjpeg -ss 5 -vframes >>> 1 -s 160x120 -an video.gif"], shell=True, s

Re: splitting words with brackets

2006-07-26 Thread Tim Chase
>> >>> r = re.compile(r'(?:\([^\)]*\)|\[[^\]]*\]|\S)+') >> >>> r.findall(s) >>['(a c)b(c d)', 'e'] > > Ah, it's exactly what I want! I thought the left and right > sides of "|" are equal, but it is not true. In theory, they *should* be equal. I was baffled by the nonparity of the situation. Yo

Weekly Python Patch/Bug Summary

2006-07-26 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 401 open ( +3) / 3342 closed ( +8) / 3743 total (+11) Bugs: 896 open ( -8) / 6035 closed (+24) / 6931 total (+16) RFE : 224 open ( +2) / 233 closed ( +2) / 457 total ( +4) New / Reopened Patches __ pkgutil.w

Re: SDL doesn't cope well with FreeSans

2006-07-26 Thread Carl Banks
Greg Ewing wrote: > Whenever I try to use the FreeSans font with SDL, > either through PyGame or Soya, I get disappointing > results. The characters come out slightly > higglety-pigglety -- randomly displaced up or down > a pixel or so from the baseline. > > Something about the calculation of the

function to convert degree (hour), minute, seconds string to integer

2006-07-26 Thread google0
I know this is a trivial function, and I've now spent more time searching for a surely-already-reinvented wheel than it would take to reinvent it again, but just in case... is there a published, open-source, function out there that takes a string in the form of "hh:mm:ss" (where hh is 00-23, mm is

Re: splitting words with brackets

2006-07-26 Thread Justin Azoff
Paul McGuire wrote: > Comparitive timing of pyparsing vs. re comes in at about 2ms for pyparsing, > vs. 0.13 for re's, so about 15x faster for re's. If psyco is used (and we > skip the first call, which incurs all the compiling overhead), the speed > difference drops to about 7-10x. I did try com

Re: Threads vs Processes

2006-07-26 Thread Joe Knapka
John Henry wrote: > >>Carl, >> OS writers provide much more tools for debugging, tracing, changing >>the priority of, sand-boxing processes than threads (in general) It >>*should* be easier to get a process based solution up and running >>andhave it be more robust, when compared to a threaded sol

Re: How to force a thread to stop

2006-07-26 Thread Gerhard Fiedler
On 2006-07-26 21:38:06, Carl J. Van Arsdall wrote: >>> Also, threading's condition and event constructs are used a lot >>> (i talk about it somewhere in that thing I wrote). They are easy to use >>> and nice and ready for me, with a server wouldn't I have to have things >>> poll/wait for messa

Re: Threads vs Processes

2006-07-26 Thread bryanjugglercryptographer
Carl J. Van Arsdall wrote: > Alright, based a on discussion on this mailing list, I've started to > wonder, why use threads vs processes. In many cases, you don't have a choice. If your Python program is to run other programs, the others get their own processes. There's no threads option on that.

Re: function to convert degree (hour), minute, seconds string to integer

2006-07-26 Thread John Machin
[EMAIL PROTECTED] wrote: > I know this is a trivial function, and I've now spent more time > searching for a surely-already-reinvented wheel than it would take to > reinvent it again, but just in case... is there a published, > open-source, function out there that takes a string in the form of > "h

Re: function to convert degree (hour), minute, seconds string to integer

2006-07-26 Thread John McMonagle
On Wed, 2006-07-26 at 20:18 -0700, John Machin wrote: > [EMAIL PROTECTED] wrote: > > I know this is a trivial function, and I've now spent more time > > searching for a surely-already-reinvented wheel than it would take to > > reinvent it again, but just in case... is there a published, > > open-so

Re: How to force a thread to stop

2006-07-26 Thread bryanjugglercryptographer
Gerhard Fiedler wrote: > Carl J. Van Arsdall wrote: > > Well, I guess I'm thinking of an event driven mechanism, kinda like > > setting up signal handlers. I don't necessarily know how it works under > > the hood, but I don't poll for a signal. I setup a handler, when the > > signal comes, if it

Re: a print bug?

2006-07-26 Thread casevh
> > > > >>> print "%10.3f" % 1.2345# seems like a bug > > > > 1.234 > > > > the first one, print knows enough to recognize and print it as 1.2345. > > however, in the second line, when it is round off, it doesn't know it > > is 1.2345 any more. That is because it isn't 1.2345 anymore. 1.2

Re: Newbie Q: Class Privacy (or lack of)

2006-07-26 Thread Steve Jobless
Sybren Stuvel wrote: > > Steve Jobless enlightened us with: > > The first case can be just a typo, like: > > > > x.valeu = 5 > > > > I make typos all the time. Without a spell checker, this message > > would be unreadable :). > > Then learn to read what you type, as you type it. Typing without

Re: SDL doesn't cope well with FreeSans

2006-07-26 Thread greg
Carl Banks wrote: > Greg Ewing wrote: > > The characters come out slightly > > higglety-pigglety -- randomly displaced up or down > > a pixel or so from the baseline. > It would depend on how you're displaying them, I would think. I've seen the same thing happen two different ways: * Rendering wi

Re: Newbie Q: Class Privacy (or lack of)

2006-07-26 Thread Ray
Hey Steve, Yes, I agree with you. The lack of checking can get confusing fast. It's not about typing without errors. Regardless of how you train as long as you're human you WILL make typos. Also having to check whether a name has already existed can be a major pain in the butt with Python. With J

Re: binding more than one attribute in a facntion

2006-07-26 Thread [EMAIL PROTECTED]
Peter Otten wrote: > [EMAIL PROTECTED] wrote: > Bound methods are limited to one implicit parameter. What you need is > partial function application: > > >>> def f(a, b, c): > ... return a + b + c > ... > >>> def partial(f, *args): > ... def g(*more): > ... return f(*args+more

Re: Scope, type and UnboundLocalError

2006-07-26 Thread Paddy
Paddy wrote: > Hi, > I am trying to work out why I get UnboundLocalError when accessing an > int from a function where the int is at the global scope, without > explicitly declaring it as global but not when accessing a list in > similar circumstances. > > The documentation: http://docs.python.org

write()

2006-07-26 Thread manuhack
I copied the lines f=open('/tmp/workfile', 'w') print f f.close() from Python 2.4 Documentation 7.2. But it said IOerror No such file or directory" '/tmp/workfile' Is it something about the os? I'm using Python 2.4 under WinXP. Thanks. Without / I can open it. -- http://mail.python.org/mail

Re: How to force a thread to stop

2006-07-26 Thread H J van Rooyen
"Carl J. Van Arsdall" <[EMAIL PROTECTED]> wrote: 8< | point). Its not only important that the threads die, but that they die | with grace. There's lots of cleanup work that has to be done when | things exit or things end up in an

MySql

2006-07-26 Thread miker2
HI, I'm having trouble writing to a MySql db using python and the MySQLdb module. Here is the code: import MySQLdb base = MySQLdb.connect(host="localhost", user="blah", passwd="blah", db="test_py") cursor = base.cursor() cursor.execute("INSERT INTO table (field) VALUES (int)") this does not work

Re: write()

2006-07-26 Thread miker2
manuhack wrote: > I copied the lines > > f=open('/tmp/workfile', 'w') > print f > f.close() > > from Python 2.4 Documentation 7.2. But it said IOerror No such file or > directory" '/tmp/workfile' > > Is it something about the os? I'm using Python 2.4 under WinXP. > Thanks. Without / I can open

Re: write()

2006-07-26 Thread manuhack
How about write mode? Changing r to w doesn't work... [EMAIL PROTECTED] wrote: > manuhack wrote: > > I copied the lines > > > > f=open('/tmp/workfile', 'w') > > print f > > f.close() > > > > from Python 2.4 Documentation 7.2. But it said IOerror No such file or > > directory" '/tmp/workfile' > >

Re: Intermittent "permission denied" errors when using os.rename and a recently deleted path??

2006-07-26 Thread Neil Hodgson
Russell Warren: > I'm actually running both... but I would think that once os.remove > returns that the file is actually gone from the hdd. Why would either > application be blocking access to a non-existent file? Does it actually tell you the target is the problem? I see an "OSError: [Errn

<    1   2   3