Re: interesting take on python OO

2007-06-02 Thread Josiah Carlson
7stud wrote: > http://www.evolt.org/article/OO_programming_the_Python_way/18/449/ > > lol I would have to agree. I could spend time talking about how bad that article was, but instead I will offer useful advice for the new Python programmer. For new users of Python and/or object-oriented prog

Re: subexpressions

2007-06-02 Thread Stef Mientki
> > > Check the two alternatives: > > def f(x): > y = x*x > return sin(y) + cos(y) > > 44 key presses, including tabs and newlines and a blank line after the > function, but excluding counting the shift key separately. > > lambda x: (lambda y: sin(y) + cos(y))(x*x) > > 42 key presses.

Re: Python Pop Quiz

2007-06-02 Thread Hendrik van Rooyen
<[EMAIL PROTECTED]> wrote: > 7. How many Z80 assembly language programmers does it take to equal > one Python guru? About one tenth of an assembly language programmer? I suppose it depends on how you define "equal". As for the bar room people - they are all people clinging to weird belief syst

Re: Cookie: Not understanding again

2007-06-02 Thread mosscliffe
On 2 Jun, 01:13, David Wahler <[EMAIL PROTECTED]> wrote: > On Jun 1, 3:49 pm, mosscliffe <[EMAIL PROTECTED]> wrote:> I have the > following code, which I thought would create a cookie, if > > one did not exist and on the html form being sent to the server, it > > would be availabe for interrogatio

Accessing the IRichEditOle interface

2007-06-02 Thread Sean Farrow
Hi: Can anyone tell me how to access the IRichEditOle interface from python. I realise I have to send a M_GETOLEINTERFACE message to the window concerned but from then on I am stuck. I carn't seem to find a type library. Any help apreciated. I am using either com types or the win32 extensions

Re: Create a new class on the fly

2007-06-02 Thread Anton Vredegoor
Alex Martelli wrote: > You can find a few examples of me demonstrating the subject of your > interest by searching for my name e.g. on video.google.com; searching > for my name on Amazon will show some books using similar techniques, and > searching for my name on groups.google.com will find about

Re: Python 2.5.1 broken os.stat module

2007-06-02 Thread Martin v. Löwis
> Reviewing my code it seems that it should still work with the 2.5.1 os.stat > changes however that does not appear to be the case. > > Timestamps reported by os.stat() are no longer correct and the results are > not even consistent. I don't think this is the case. The results Python reports a

Re: Python Pop Quiz

2007-06-02 Thread Tijs
[EMAIL PROTECTED] wrote: > 1. Do you like Python? Yes > > 2. Do you think Python is good? Yes > > 3. Do you think Python is real good? No. If it were real good, it would have type inference and (based on that) compile-time type checking and optimized native-code compilation. Of course, ty

Re: Python 2.5.1 broken os.stat module

2007-06-02 Thread Martin v. Löwis
>> How did you do that? > > I used a "touch" utility to set the dates but let's try it a different way. What touch utility specifically? Is source code available of that tool? > Looks like Python 2.4.2 is reporting the timestamps correctly Unfortunately, no. Python 2.4 (and earlier) has an erro

Re: Python 2.5.1 broken os.stat module

2007-06-02 Thread Martin v. Löwis
> File Name : P:\sw\Python\Lib\cgi.pyc > > python_access_ts: 05/31/2007 07:17 PM > win_access_ts : 05/31/2007 06:35 PM > > File Name : P:\sw\Python\Lib\code.pyc > > python_access_ts: 05/30/2007 07:59 PM > win_access_ts : 05/30/2007 07:22 PM I have analyzed these cases in mor

Re: Python Pop Quiz

2007-06-02 Thread James Stroud
[EMAIL PROTECTED] wrote: > Essay: "C++ is better than C", agree or disagree? (four word maximum) disagree: too many pluses. -- http://mail.python.org/mailman/listinfo/python-list

Re: Cookie: Not understanding again

2007-06-02 Thread David Wahler
On Jun 2, 9:32 am, mosscliffe <[EMAIL PROTECTED]> wrote: > David, > > Thanks for your help. > > I spent all last night trying to get it to work, but I can not work > out how to force my cookie into the response header. The most > annoying part is on one occasion it did and the cookie sat there unt

Re: Observer-Pattern by (simple) decorator

2007-06-02 Thread David Wahler
On Jun 2, 12:27 am, Steven Bethard <[EMAIL PROTECTED]> wrote: > I think you want to define __get__ on your Observable class so that it > can do the right thing when the method is bound to the instance: > > >>> class Observable(object): > ... def __init__(self, func, instance=None, observers=No

Re: Python Pop Quiz

2007-06-02 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > Bonus: A rabbi walks into a bar while nursing a baby goat. He is > closely followed by a priest, and a Perl hacker. Explain. Getting religious, eh? :) http://xkcd.com/c224.html Regards, Björn -- BOFH excuse #14: sounds like a Windows problem, try calling Microso

Re: PythonCard or Dabo?

2007-06-02 Thread SPE - Stani's Python Editor
On Jun 2, 7:20 am, Bill Maxwell <[EMAIL PROTECTED]> wrote: > On 19 Mar 2007 10:40:03 -0700, [EMAIL PROTECTED] wrote: > > ...>You might want to submit this to the wxpython news-group. > > ... > > What is the name of this newsgroup? I can't seem to locate it on my > news server. > > Thanks, > > Bill

Re: Python Pop Quiz

2007-06-02 Thread Michael Bentley
On Jun 1, 2007, at 9:33 PM, [EMAIL PROTECTED] wrote: > 1. Do you like Python? It's pretty good. > 2. Do you think Python is good? It's pretty good. > 3. Do you think Python is real good? It's pretty good. > 4. What is your favorite version of Python? The one I have. > 5. Because of Python,

Re: Python Pop Quiz

2007-06-02 Thread Dustan
On Jun 1, 9:33 pm, [EMAIL PROTECTED] wrote: > 1. Do you like Python? yes > 2. Do you think Python is good? yes > 3. Do you think Python is real good? yes > 4. What is your favorite version of Python? The most recent one. > 5. Because of Python, do you think it will be easier to take over th

Re: Creating a distro of python... What would you include in it?

2007-06-02 Thread SPE - Stani's Python Editor
On May 30, 7:47 pm, yuce <[EMAIL PROTECTED]> wrote: > re: BJörn, I think selecting a GPL license will increase the number of > usable packages, since using Python license with GPL is perfectly fine > as long as the whole software is licensed under GPL [I am not really > sure it is a must to license

Re: Python Pop Quiz

2007-06-02 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]>, Roy Smith > wrote: > > > In article <[EMAIL PROTECTED]>, > > [EMAIL PROTECTED] wrote: > >> 7. How many Z80 assembly language programmers does it take to equal > >> one Python guru? > >

Re: subexpressions

2007-06-02 Thread Steve Howell
> >def f(x): y = x*x; return sin(y)+cos(y); > Although I know valid trigonometry is not the point of this exercise, I'm still trying to figure out why anybody would ever take the square of an angle. What's the square root of pi/4 radians?

Re: Observer-Pattern by (simple) decorator

2007-06-02 Thread Wildemar Wildenburger
David Wahler wrote: > Is this desired behavior? > > a = SomeActor() b = SomeActor() a.meth.observers is b.meth.observers > True > No it's not, but I get >>> a = SomeActor() >>> b = SomeActor() >>> a.meth.observers is b.meth.observers False I don't see how your

Re: file reading by record separator (not line by line)

2007-06-02 Thread George Sakkis
On Jun 1, 7:00 am, Steve Howell <[EMAIL PROTECTED]> wrote: > --- Tijs <[EMAIL PROTECTED]> wrote: > > > Yes, or a single one that takes a wide range of > > construction possibilities, > > like strings, lambdas or regexes in various keyword > > parameters. > > > BlockReader(f, start='>') > > BlockRea

Re: c[:]()

2007-06-02 Thread Bruce Coram
I am a relative newbie to Python and certainly to this mailing list. I have watched this thread with interest. After the first few exchanges I thought it would prove interesting and it has. Warren Stringer is one of two things: A joker having some fun at your expense. An intellectually prete

Python rocks

2007-06-02 Thread Mark Carter
Well, I know I'm preaching to the converted - but Python rocks. I've been enchanted by the siren calls of Scheme, Lisp and Forth, but in the end, I find Python much easier. I even tried a little bit of Tcl. To give a bit of context ... I have recently switched from Windows to OS X and Linux. I

Re: subexpressions

2007-06-02 Thread Steven D'Aprano
On Sat, 02 Jun 2007 05:54:51 -0700, Steve Howell wrote: >> >>def f(x): y = x*x; return sin(y)+cos(y); >> > > Although I know valid trigonometry is not the point of > this exercise, I'm still trying to figure out why > anybody would ever take the square of an angle. > What's the square root

Re: Observer-Pattern by (simple) decorator

2007-06-02 Thread Peter Otten
Wildemar Wildenburger wrote: > David Wahler wrote: >> Is this desired behavior? >> >> > a = SomeActor() > b = SomeActor() > a.meth.observers is b.meth.observers > >> True >> > No it's not, but I get > a = SomeActor() b = SomeActor() a.meth.observers i

Re: subexpressions

2007-06-02 Thread Stef Mientki
Steve Howell wrote: >>def f(x): y = x*x; return sin(y)+cos(y); >> > > Although I know valid trigonometry is not the point of > this exercise, I'm still trying to figure out why > anybody would ever take the square of an angle. > What's the square root of pi/4 radians? Maybe he meant sin(x)

Re: Observer-Pattern by (simple) decorator

2007-06-02 Thread David Wahler
On Jun 2, 3:00 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > Then you have modified the code posted by Steven Bethard. > > > I don't see how your behaviour should come about ... a new observer-list > > is created for every decorated method, so there is no problem. > > Yes, but that list is shared a

Re: speeding things up with C++

2007-06-02 Thread Jorgen Grahn
On Thu, 31 May 2007 12:25:17 -0500, Chris Mellon <[EMAIL PROTECTED]> wrote: > On 31 May 2007 03:45:32 -0700, bullockbefriending bard > <[EMAIL PROTECTED]> wrote: >> Thanks this is good news. I think my C/C++ background is sufficient to >> manage to figure things out if I RTFM carefully. >> >> Basic

monitoring the filesystem for changes

2007-06-02 Thread rohit
hello, i have designed a desktop search utility in python and a file system monitoring using readdirectorychangesw from win32api but for eg. it has a high cpu utilization (using a 2GHz processor). a solution ntfs change journal proposed here works only for ntfs partitions is there another low (proc

Re: subexpressions (OT: math)

2007-06-02 Thread Steve Howell
--- Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sat, 02 Jun 2007 05:54:51 -0700, Steve Howell > wrote: > > >> > >>def f(x): y = x*x; return sin(y)+cos(y); > >> > > > > Although I know valid trigonometry is not the > point of > > this exercise, I'm still trying to figure out why > > an

Re: subexpressions

2007-06-02 Thread Steve Howell
--- Stef Mientki <[EMAIL PROTECTED]> wrote: > Maybe he meant >sin(x)^2 + cos(x)^2 > which is well known demodulation technique if you > create two signals 90 degrees out of phase. > There's a shorter way to phrase that expression, of course. :) 1

Re: Observer-Pattern by (simple) decorator

2007-06-02 Thread Wildemar Wildenburger
Peter Otten wrote: > Then you have modified the code posted by Steven Bethard. > > Oops. Indeed I did. I changed this >>> class Observable(object): ... def __init__(self, func, instance=None, observers=None): ... if observers is None: ... observers = [] ... self.

Re: subexpressions (fourier example)

2007-06-02 Thread Steve Howell
--- Steve Howell <[EMAIL PROTECTED]> wrote: > > --- Stef Mientki <[EMAIL PROTECTED]> > wrote: > > Maybe he meant > >sin(x)^2 + cos(x)^2 > > which is well known demodulation technique if you > > create two signals 90 degrees out of phase. > > > A more realistic subexpression where you migh

Re: Observer-Pattern by (simple) decorator

2007-06-02 Thread Wildemar Wildenburger
David Wahler wrote: > > Here's my attempt at an implementation that works as a decorator. It > stores the observers in a dictionary attribute of the instance, using > the method name as a key. For example: > > > [snip: another nice aproach] > Anyway, these are just my initial thoughts -- I don't

Re: file reading by record separator (not line by line)

2007-06-02 Thread Steve Howell
--- George Sakkis <[EMAIL PROTECTED]> wrote: > > It seems > > like it would be fairly straightforward to do a > quick > > prototype implementation of this. I'm off to work > > soon, so I can't do it today, but maybe Sunday. > > I'm afraid I beat you to it :) > http://aspn.activestate.com/ASPN/

Re: Observer-Pattern by (simple) decorator

2007-06-02 Thread Peter Otten
Wildemar Wildenburger wrote: > Thanks for the thorough explanation. But you did mock me with that > "SomeActor.meth is SomeActor.meth"-line, right? ;) Acually, no: >>> class Descriptor(object): ... def __get__(*args): return object() ... >>> class SomeActor(object): ... meth = Descriptor

Re: Observer-Pattern by (simple) decorator

2007-06-02 Thread Steven Bethard
David Wahler wrote: > On Jun 2, 12:27 am, Steven Bethard <[EMAIL PROTECTED]> wrote: >> I think you want to define __get__ on your Observable class so that it >> can do the right thing when the method is bound to the instance: [snip] > Is this desired behavior? > a = SomeActor() b = SomeA

Re: Observer-Pattern by (simple) decorator

2007-06-02 Thread Wildemar Wildenburger
Peter Otten wrote: class Descriptor(object): > ... def __get__(*args): return object() > ... > class SomeActor(object): > ... meth = Descriptor() > ... > SomeActor.meth is SomeActor.meth > False > Of course ... Man, this lang

Re: file reading by record separator (not line by line)

2007-06-02 Thread Steve Howell
--- Steve Howell <[EMAIL PROTECTED]> wrote: > > Can I suggest a minor optimization? > > Instead of this... > > def get_predicate(arg): > return arg if callable(arg) else ( >arg.__eq__ if hasattr(arg,'__eq__') > else >lambda item: item == arg) > Neve

Re: Observer-Pattern by (simple) decorator

2007-06-02 Thread Steven Bethard
Wildemar Wildenburger wrote: class Observable(object): > ... def __init__(self, func, instance=None, observers=None): > ... self.func = func > ... self.instance = instance > ... self.observers = observers or [] Unless you also changed code in __get__, this means yo

Trouble killing a process on windows

2007-06-02 Thread Thomas Nelson
Hi, I'd like to start a program, run it for a while, then terminate it. I can do this on linux, but I'm new to working with windows. Here's my script: from subprocess import Popen from time import sleep import win32api war3game = Popen(["C:\Program Files\Warcraft III\Frozen Throne.exe"]) sleep(30

Re: Python rocks

2007-06-02 Thread Steve Howell
--- Mark Carter <[EMAIL PROTECTED]> wrote: > Well, I know I'm preaching to the converted - but > Python rocks. > [...] A few questions from the choir: As a recent newcomer to the language, did you encounter any traps or pitfalls while you were learning? Also, could you single out anything in p

Re: Trouble killing a process on windows

2007-06-02 Thread Tim Golden
Thomas Nelson wrote: > from subprocess import Popen > from time import sleep > import win32api > war3game = Popen(["C:\Program Files\Warcraft III\Frozen Throne.exe"]) > sleep(30) > print "slept for 30" > print win32api.TerminateProcess(int(war3game._handle),-1) > #print > ctypes.windll.kernel32.Te

Re: Observer-Pattern by (simple) decorator

2007-06-02 Thread Wildemar Wildenburger
Steven Bethard wrote: > Wildemar Wildenburger wrote: > > class Observable(object): > >> ... def __init__(self, func, instance=None, observers=None): >> ... self.func = func >> ... self.instance = instance >> ... self.observers = observers or [] >>

[Fwd: Re: Trouble killing a process on windows]

2007-06-02 Thread Tim Golden
Tim Golden wrote: > Thomas Nelson wrote: [... re problem Terminating process ...] >> File "C:\Python24\warcraft\runwar3.py", line 7, in ? >> print win32api.TerminateProcess(int(war3game._handle),-1) >> error: (5, 'TerminateProcess', 'Access is denied.') >> >> I'm logged in as adminstrator.

Re: Python 2.3 ODBC Datetime limitations

2007-06-02 Thread Steve Holden
YuePing Lu wrote: > Hello, > > Has any of you ever used Python odbc to retrieve data from a relational DB? > > I encountered a problem where it can't handle datetime _earlier than > _*1969*, and _later than _*2040*. It just returned some garbage strings > when I call str(my_date_object). > > W

Re: Delete a file from a CGI

2007-06-02 Thread Matias Surdi
Steve Holden escribió: > Matias Surdi wrote: >> Thanks for your reply. >> >> This is the code that creates the file: >> lock_file = open(".lock","w") >> lock_file.write("test") >> lock_file.close() >> #Change permissions so that CGI can write lock file >> os.chmod(".lock",stat.S_IMODE(stat.S_IRWX

iterblocks cookbook example

2007-06-02 Thread Steve Howell
George Sakkis produced the following cookbook recipe, which addresses a common problem that comes up on this mailing list: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/521877 I would propose adding something like this to the cookbook example above. def iterblocks2(lst, start_delim):

SMTPlib Sender Refused?

2007-06-02 Thread erikcw
Hi, I'm trying to send an email message with python, and I'm getting this error: Traceback (most recent call last): File "wa.py", line 430, in ? main() File "wa.py", line 425, in main smtp.sendmail(fromaddr, to, msg.encode('utf-8')) File "/usr/local/lib/python2.4/smtplib.py", line 6

Re: PythonCard or Dabo?

2007-06-02 Thread Terry Reedy
"Bill Maxwell" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | On 19 Mar 2007 10:40:03 -0700, [EMAIL PROTECTED] wrote: | | ... | >You might want to submit this to the wxpython news-group. | ... | | What is the name of this newsgroup? I can't seem to locate it on my | news server.

Automating a telnet session with an echo to stdout

2007-06-02 Thread Samuel
Hi, I am trying to automate a telnet session (currently using Python's telnetlib) and would like to echo any response of the remote host to stdout, as soon as it arrives on telnetlib's open TCP socket. Currently I print the return value of the read_some() method (or other read* methods) to the

Re: Python rocks

2007-06-02 Thread Mark Carter
Steve Howell wrote: > --- Mark Carter <[EMAIL PROTECTED]> wrote: > >> Well, I know I'm preaching to the converted - but >> Python rocks. >> [...] > > A few questions from the choir: > > As a recent newcomer to the language, did you > encounter any traps or pitfalls while you were > learning? Al

Re: Python rocks

2007-06-02 Thread George Sakkis
On Jun 2, 12:31 pm, Steve Howell <[EMAIL PROTECTED]> wrote: > --- Mark Carter <[EMAIL PROTECTED]> wrote: > > > Well, I know I'm preaching to the converted - but > > Python rocks. > > [...] > > A few questions from the choir: > > As a recent newcomer to the language, did you > encounter any traps or

Error message if there is a space in the source directory

2007-06-02 Thread lukefrancomusic
I am trying to learn Python. I am working on a simple backup program (code listed below). When using a source directory (the files to be backed up) without spaces in the title, my program works fine [see line 5]. If I try to access a directory with a space in the name the program fails with this er

Non-blocking subprocess call

2007-06-02 Thread Kevin Walzer
I'm currently using os.popen in an application of mine, which calls for non-blocking data, in this fashion: self.file = os.popen('echo %s | sudo -S /sw/bin/fink -y install %s' % (self.passtext, self.packagename), 'r', os.O_NONBLOCK) What is the equivalent/comparable call in the new subprocess

RE: c[:]()

2007-06-02 Thread Warren Stringer
Andre Engels wrote: > > I am not insisting on anything. I use ``c[:]()`` as shorthand way of > saying > > "c() for c in d where d is a container" > > > > Having c() support containers seems obvious to me. It jibes with duck > > typing. Perhaps the title of this thread should have been: "Why don't >

Re: Error message if there is a space in the source directory

2007-06-02 Thread Mark Peters
> When using a source like this on line 5: > > source = [r'C:\test\test 2\\'] > > which has a space in the title, the program will not work. Try wrapping that argument in double quotes when you build the command -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.3 ODBC Datetime limitations

2007-06-02 Thread Tim Golden
Steve Holden wrote: > YuePing Lu wrote: >> Hello, >> >> Has any of you ever used Python odbc to retrieve data from a relational DB? >> >> I encountered a problem where it can't handle datetime _earlier than >> _*1969*, and _later than _*2040*. It just returned some garbage strings >> when I call

RE: c[:]()

2007-06-02 Thread Warren Stringer
Oops, forgot to cut and paste the point, to this: > > - there is no Python error for "you > > cannot do this with this object, but you can do it with other objects > > of the same type". > > Yes there is: > > # > def yo(): print "yo" > def no(): print blah > yo() > no()

com_error 'Exception occurred'

2007-06-02 Thread Richard Gordon
I've got a fatal bug using Parente's pyTTS with Python 2.3 on Windoze 32 using MS SAPI 5.1 and Hammond's win32 module. The test program is import pyTTS tts = pyTTS.Create() tts.Speak('Hello world.') The resulting debug trace is: PythonWin 2.3.5 (#62, Feb 8 2005, 16:23:02) [MSC v.1200 32

Re: Using PIL to find separator pages

2007-06-02 Thread Steve Holden
Larry Bates wrote: > Steve Holden wrote: >> Larry Bates wrote: >>> Steve Holden wrote: Larry Bates wrote: > I have a project that I wanted to solicit some advice > on from this group. I have millions of pages of scanned > documents with each page in and individual .JPG file. >

Please help! win32 com_error 'Exception occurred'

2007-06-02 Thread Richard Gordon
I've got a fatal bug using Parente's pyTTS with Python 2.3 on Windoze 32 using MS SAPI 5.1 and Hammond's win32 module. The test program is import pyTTS tts = pyTTS.Create() tts.Speak('Hello world.') The resulting debug trace is: PythonWin 2.3.5 (#62, Feb 8 2005, 16:23:02) [MSC v.1200 32

Need help! win32 com_error 'Exception occurred'

2007-06-02 Thread Richard Gordon
I've got a fatal bug using Parente's pyTTS with Python 2.3 on Windoze 32 using MS SAPI 5.1 and Hammond's win32 module. The test program is import pyTTS tts = pyTTS.Create() tts.Speak('Hello world.') The resulting debug trace is: PythonWin 2.3.5 (#62, Feb 8 2005, 16:23:02) [MSC v.1200 32

Strange behavior in Windows

2007-06-02 Thread Jakob Svavar Bjarnason
Greetings. I have been trying to switch to Python from other languages such as Perl and now I have a newbie question. I have been trying to run a setup script to install a python library. To do that I need to run "c:> python setup.py install" but the strange thing is is that when it runs the

Re: Python Pop Quiz

2007-06-02 Thread k47867
> 1. Do you like Python? > Yes, or I wouldn't still be subscribed to the python-list. > 2. Do you think Python is good? s Yes. Well it is a good Language. I can code in python at-least twice as fast as I could in C or C++. > > 3. Do you think Python is real good? > Yeah, if you meant 'very' instead

** VIDEO SPEECH OF PAKISTANIAN CHIEF JUSTICE REQUESTED ***

2007-06-02 Thread thermate
The nexus between 911 truth movement and its success is closely related to the democratic victory in Pakistan. The Pakistanian Military Dictator, a foolish patsy of Bush-Neocon- Crime Syndicate, provided critical validation to the 911 LIE by implicitly buckling under the false conspiracy theory.

Re: Using PIL to find separator pages

2007-06-02 Thread Steve Holden
Steve Holden wrote: > Larry Bates wrote: [...] >> I think I've come up with something that will work. I use PIL >> Image.getcolors() to get colors and take the top 10 colors of my >> background page. I then calculate the average of the R, G, B >> components. That becomes my reference. Then I re

Re: Detecting an active exception

2007-06-02 Thread Steve Holden
Duncan Booth wrote: > "NeBlackCat (lists)" <[EMAIL PROTECTED]> wrote: > >> Depending on what you read, sys.exc_info() is supposed to return >> (None,None,None) when there is no active exception, but it seems that >> it returns info about the last exception when there isn't one >> currently active

Help with win32 com_error exception

2007-06-02 Thread Richard Gordon
Sorry if this is sent twice, but I didn't see it get posted the first time. I've got a fatal bug using Parente's pyTTS with Python 2.3 on Windoze 32 using MS SAPI 5.1 and Hammond's win32 module. The test program is import pyTTS tts = pyTTS.Create() tts.Speak('Hello world.') The resulting de

Re: Python rocks

2007-06-02 Thread Josiah Carlson
Mark Carter wrote: > Not that I'm particularly knowledgeable about language design issues, > but maybe closures and slightly different scoping rules would be nice. Python has had closures for years. What kind of scoping did you desire? > A > pitfall of Python is knowing whether an operation is

Re: Non-blocking subprocess call

2007-06-02 Thread Josiah Carlson
Kevin Walzer wrote: > I'm currently using os.popen in an application of mine, which calls for > non-blocking data, in this fashion: > > self.file = os.popen('echo %s | sudo -S /sw/bin/fink -y install %s' % > (self.passtext, self.packagename), 'r', os.O_NONBLOCK) > > What is the equivalent/comp

RE: Help with win32 com_error exception

2007-06-02 Thread David Stockwell
Hi Rich, I've seen errors like this before. first off it will help you better if you represent your error in hex. Doing so yields this 80020009 <==> -2147352567 0x 0x80020009 Anyways, its probably the result of something not being either registered/installed correctly (

Re: iterblocks cookbook example

2007-06-02 Thread Raymond Hettinger
On Jun 2, 10:19 am, Steve Howell <[EMAIL PROTECTED]> wrote: > George Sakkis produced the following cookbook recipe, > which addresses a common problem that comes up on this > mailing list: ISTM, this is a common mailing list problem because it is fun to solve, not because people actually need it o

Re: Non-blocking subprocess call

2007-06-02 Thread Kevin Walzer
Josiah Carlson wrote: > > If you are talking about non-blocking reading and writing from the > subprocess, there isn't natively. But there is a cookbook entry: > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440554 > > - Josiah Any idea why this feature was removed from the lan

Re: Python rocks

2007-06-02 Thread Aahz
In article <[EMAIL PROTECTED]>, George Sakkis <[EMAIL PROTECTED]> wrote: > >I had probably stumbled on many/most of the common pitfalls usually >mentioned (e.g. http://www.ferg.org/projects/python_gotchas.html, >http://zephyrfalcon.org/labs/python_pitfalls.html) while learning, but >picked them up

Re: Python rocks

2007-06-02 Thread Mark Carter
Josiah Carlson wrote: > Mark Carter wrote: >> Not that I'm particularly knowledgeable about language design issues, >> but maybe closures and slightly different scoping rules would be nice. > > Python has had closures for years. I just looked up http://www.secnetix.de/~olli/Python/lambda_functio

Re: Help with win32 com_error exception

2007-06-02 Thread Andrew Holme
"Richard Gordon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Sorry if this is sent twice, but I didn't see it get posted the first > time. > > I've got a fatal bug using Parente's pyTTS with Python 2.3 on Windoze 32 > using MS SAPI 5.1 and Hammond's win32 module. The test progr

Re: PythonCard or Dabo?

2007-06-02 Thread Ed Leafe
On Jun 2, 2007, at 7:22 AM, SPE - Stani's Python Editor wrote: > Another alternative are GUI designers such as wxGlade or XRCed, both > of which ship with SPE (http://pythonide.stani.be). Dabo is especially > usefull (but not limited to) developping database applications as it > is an open source

Re: Error message if there is a space in the source directory

2007-06-02 Thread Peter Otten
[EMAIL PROTECTED] wrote: > I am trying to learn Python. I am working on a simple backup program > (code listed below). When using a source directory (the files to be > backed up) without spaces in the title, my program works fine [see > line 5]. If I try to access a directory with a space in the

Re: SMTPlib Sender Refused?

2007-06-02 Thread reed
On Jun 2, 1:20 pm, erikcw <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to send an email message with python, and I'm getting this > error: > > Traceback (most recent call last): > File "wa.py", line 430, in ? > main() > File "wa.py", line 425, in main > smtp.sendmail(fromaddr, to, ms

Re: Trouble killing a process on windows

2007-06-02 Thread reed
On Jun 2, 12:27 pm, Thomas Nelson <[EMAIL PROTECTED]> wrote: > Hi, I'd like to start a program, run it for a while, then terminate > it. I can do this on linux, but I'm new to working with windows. > Here's my script: > > from subprocess import Popen > from time import sleep > import win32api > wa

Re: Python Pop Quiz

2007-06-02 Thread reed
On Jun 1, 10:33 pm, [EMAIL PROTECTED] wrote: > 1. Do you like Python? 0 > 2. Do you think Python is good? 0 > 3. Do you think Python is real good? 0 > 4. What is your favorite version of Python? 2.4+ > 5. Because of Python, do you think it will be easier to take over the > world? If so, when? I

can this be implemented?

2007-06-02 Thread greenflame
First I should start with some introductory comments. When I first learned about programming, I started with BASIC, QBASIC to be more accurate. While I was at that stage, I learned about the INPUT command. I used it abundantly. Ok so now for the actual issue. I would like to implement something

Re: can this be implemented?

2007-06-02 Thread Dan Bishop
On Jun 2, 6:54 pm, greenflame <[EMAIL PROTECTED]> wrote: > First I should start with some introductory comments. > > When I first learned about programming, I started with BASIC, QBASIC > to be more accurate. While I was at that stage, I learned about the > INPUT command. I used it abundantly. > >

Re: __getslice__ depreciation

2007-06-02 Thread Michael Hoffman
[EMAIL PROTECTED] wrote: > On Jun 1, 7:50 pm, [EMAIL PROTECTED] wrote: >> If __getslice__ is depreciated (since version 2.0) why are neither >> __setslice__ or __delslice__ >> depreciated?http://docs.python.org/ref/sequence-methods.html > > Sorry disregard that, I should have RTFA A request to h

pythonwin closes unexpectedlyI

2007-06-02 Thread leegold
Hi, I run a script in PythonWin and obviously some sort of an error occurs in the script and PythonWin closes. No warning, no error message just closes. I definitely know the line of code that causes the problem and will cite the code below. Note: I'm using ArcGIS 9.1 (Python 2.1 is bundled wit

Re: Jinja 1.1 Released

2007-06-02 Thread Ben Finney
Armin Ronacher <[EMAIL PROTECTED]> writes: > Jinja 1.1 Released > == > > Jinja 1.1 codenname sinka is out! And with more changes then ever. > Here a small summary of the new features and improvements: This gives the reader no information about what Jinja actually is. It's far pref

Re: Python rocks

2007-06-02 Thread Alex Martelli
Mark Carter <[EMAIL PROTECTED]> wrote: > I picked Chicken Scheme for OS X. Things started well, and even the web ... > that; but I found that it ultimately depended on gmp, which turned out a > pain to compile. Yes, GMP is a pain to compile (especially on Mac OS X), but I believe that the Univ

Re: Python rocks

2007-06-02 Thread Alex Martelli
Josiah Carlson <[EMAIL PROTECTED]> wrote: > > pitfall of Python is knowing whether an operation is destructive or not. > > If it returns None, it probably changes the content of an object. A reasonable heuristic, but with lots of exceptions, alas: somedict.get(somekey) will often return None

RE: c[:]()

2007-06-02 Thread Steven D'Aprano
On Sat, 02 Jun 2007 11:25:04 -0700, Warren Stringer wrote: > Since `a()` translates to `a() for a in b` then the error would be the exact > same `TypeError: 'str' object is not callable` Not in any language called Python I know of. Supposedly 28 years programming experience, and you can't even s

Re: can this be implemented?

2007-06-02 Thread greenflame
On Jun 2, 5:05 pm, Dan Bishop <[EMAIL PROTECTED]> wrote: > On Jun 2, 6:54 pm, greenflame <[EMAIL PROTECTED]> wrote: > > > First I should start with some introductory comments. > > > When I first learned about programming, I started with BASIC, QBASIC > > to be more accurate. While I was at that st

Re: subexpressions (OT: math)

2007-06-02 Thread Steven D'Aprano
On Sat, 02 Jun 2007 08:29:59 -0700, Steve Howell wrote: > > --- Steven D'Aprano > <[EMAIL PROTECTED]> wrote: > >> On Sat, 02 Jun 2007 05:54:51 -0700, Steve Howell >> wrote: >> >> >> >> >>def f(x): y = x*x; return sin(y)+cos(y); >> >> >> > >> > Although I know valid trigonometry is not th

Re: Python 2.5.1 broken os.stat module

2007-06-02 Thread Joe Salmeri
> It's not clear whether it's an error, however, localtime() does > something different from what dir does. Hi Martin, First off thank you for spending your time to investigate this bug with me. Thanks for pointing out the issue with Windows XP caching the access timestamps, I was not aware of

Re: Python 2.3 ODBC Datetime limitations

2007-06-02 Thread John Machin
On Jun 3, 4:47 am, Tim Golden <[EMAIL PROTECTED]> wrote: > Steve Holden wrote: > > YuePing Lu wrote: > >> Hello, > > >> Has any of you ever used Python odbc to retrieve data from a relational DB? > > >> I encountered a problem where it can't handle datetime _earlier than > >> _*1969*, and _later th

Re: Python rocks

2007-06-02 Thread Josiah Carlson
Mark Carter wrote: > Josiah Carlson wrote: >> What kind of scoping did you desire? > > Well, I had in mind so that if you defined a function, but wanted to > access a global var, that you didn't have to use the global keyword. Not > much of a biggie, I guess. You already get read access to glo

int vs long

2007-06-02 Thread jay
I was reading in a book that the 'int' type can store whole numbers up to 32 bits. I'm not exactly sure what that means, but got me wondering, what's the largest number you can store as an 'int' before you need to switch over to 'long'? Thanks for looking at my question. Jay -- http://mai

Re: Trouble killing a process on windows

2007-06-02 Thread Thomas Nelson
On Jun 2, 11:43 am, Tim Golden <[EMAIL PROTECTED]> wrote: > Thomas Nelson wrote: > > from subprocess import Popen > > from time import sleep > > import win32api > > war3game = Popen(["C:\Program Files\Warcraft III\Frozen Throne.exe"]) > > sleep(30) > > print "slept for 30" > > print win32api.Termin

Re: int vs long

2007-06-02 Thread Dan Bishop
On Jun 2, 9:30 pm, jay <[EMAIL PROTECTED]> wrote: > I was reading in a book that the 'int' type can store whole numbers > up to 32 bits. I'm not exactly sure what that means, but got me > wondering, what's the largest number you can store as an 'int' before > you need to switch over to 'long'? sy

Re: monitoring the filesystem for changes

2007-06-02 Thread momobear
> i have designed a desktop search utility in python and a file system > monitoring using readdirectorychangesw from win32api but for eg. it > has a high cpu utilization (using a 2GHz processor). I don't think so. I just build a service to monitor a directory changes using readdirectorychangesw, t

  1   2   >