Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread Dick Moores
At 06:38 PM 10/29/2007, Kent Johnson wrote: Dick Moores wrote: 1. Is wrapping the long lines where I have done so OK? I usually indent the second line of a wrapped line so it stands out more. Done in newest version 10 < http://www.rcblue.com/Python/chessTimerForWebV10.py> 2. I've used 1 for Whit

Re: [Tutor] repeated times

2007-10-29 Thread Luke Paireepinart
linda.s wrote: > I want to run an .exe file and get the output many times. > Can any one give me an example about how to use python to generate the > automatic process? > Yes. -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread Kent Johnson
Dick Moores wrote: > 1. Is wrapping the long lines where I have done so OK? I usually indent the second line of a wrapped line so it stands out more. > 2. I've used 1 for White player, -1 for Black player, and (-1)*player > to alternate players. Is there a better way? > 3. I've used a lot of vari

Re: [Tutor] python image libray - source to Mac OS X

2007-10-29 Thread Reed O'Brien
On Oct 29, 2007, at 7:54 PM, elis aeris wrote: http://www.pythonware.com/products/pil/#pil116 has anyone been able to compile this on Mac os x? http://two.pairlist.net/pipermail/reportlab-users/2007-October/ 006262.html ___ Tutor maillist -

[Tutor] repeated times

2007-10-29 Thread linda.s
I want to run an .exe file and get the output many times. Can any one give me an example about how to use python to generate the automatic process? Thanks, Linda ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] python image libray - source to Mac OS X

2007-10-29 Thread Kent Johnson
elis aeris wrote: > http://www.pythonware.com/products/pil/#pil116 > > > has anyone been able to compile this on Mac os x? There is a compiled version here so I guess someone did ;-) http://www.pythonmac.org/packages/py25-fat/index.html The Python-mac list would probably be a good place for mor

Re: [Tutor] calculation with arrays: shape mismatch

2007-10-29 Thread Kent Johnson
Alan Gauld wrote: > "John" <[EMAIL PROTECTED]> wrote > >> Sorry, here's the output from the command line >> > run Day_footprint.py > > Sorry for all the questions but I've never seen that "run" syntax > before. > What environment are you running? What IDE/OS/Python version etc? IPython has

Re: [Tutor] python image libray

2007-10-29 Thread Alan Gauld
"elis aeris" <[EMAIL PROTECTED]> wrote > http://www.pythonware.com/products/pil/#pil116 > > > how do I distribute standalone python executable with some contents > of this > library? If you import pil then most (all?) of the exe builders will automatically drag it into the final executable file

Re: [Tutor] calculation with arrays: shape mismatch

2007-10-29 Thread Alan Gauld
"John" <[EMAIL PROTECTED]> wrote > To be honest, part of the problem is that I work in about four > different > Python environments!! > This here was just a cut from running a script I wrote at the DOS > prompt... > but that is not my usual flavor. really? What Python version are you using? Is

[Tutor] python image libray - source to Mac OS X

2007-10-29 Thread elis aeris
http://www.pythonware.com/products/pil/#pil116 has anyone been able to compile this on Mac os x? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] python image libray

2007-10-29 Thread elis aeris
http://www.pythonware.com/products/pil/#pil116 how do I distribute standalone python executable with some contents of this library? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] calculation with arrays: shape mismatch

2007-10-29 Thread John
Well, To be honest, part of the problem is that I work in about four different Python environments!! I've had a hard time getting the scipy suite to work fully on windows, and for number crunching it's just easier to run in linux. This here was just a cut from running a script I wrote at the DOS p

Re: [Tutor] calculation with arrays: shape mismatch

2007-10-29 Thread Alan Gauld
"John" <[EMAIL PROTECTED]> wrote > Sorry, here's the output from the command line > run Day_footprint.py Sorry for all the questions but I've never seen that "run" syntax before. What environment are you running? What IDE/OS/Python version etc? > trying... > header has been opened > succes

Re: [Tutor] script ?

2007-10-29 Thread Alan Gauld
"Dan Freeman" <[EMAIL PROTECTED]> wrote > How can I have this script exucute a .exe file instead of beeping > the system > speaker? The same way you ran netstat - which is an .exe... Of course, nowadays you probably should be using subprocess.Popen instead os os.popen, but thats a minor tik. A

[Tutor] script ?

2007-10-29 Thread Dan Freeman
How can I have this script exucute a .exe file instead of beeping the system speaker? __ import os import time z = 2 while z ==2: connected = False while not connected: o=os.popen("netstat -an") for l in o: try:

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread Dick Moores
I've developed chessTimer a bit further: I'm still hoping for some constructive criticism. But I also thought I'd mention again the points I have doubts about: 1. Is wrapping the long lines where I have done so OK? 2. I've used 1 for White play

Re: [Tutor] calculation with arrays: shape mismatch

2007-10-29 Thread John
Sorry, here's the output from the command line >>>run Day_footprint.py trying... header has been opened succes! Reading grid 2006051100 at: Mon Oct 29 16:57:57 2007 processing: 2006051100 Traceback (most recent call last): File "Day_footprint.py", line 48, in ? contribution=[contri

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread Eric Brunson
Dick Moores wrote: > At 07:54 AM 10/29/2007, Eric Brunson wrote: > >> Dick Moores wrote: >> >>> At 05:03 AM 10/29/2007, bhaaluu wrote: >>> >>> On 10/29/07, Dick Moores <[EMAIL PROTECTED]> wrote: > Seems I should clarify that. I'm not looking for a script t

Re: [Tutor] calculation with arrays: shape mismatch

2007-10-29 Thread Alan Gauld
"John" <[EMAIL PROTECTED]> wrote > > But I get the error: > ValueError: shape mismatch: objects cannot be broadcast to a single > shape > > for the highlighted line. When sending error messages send the entire error traceback not just the summary message. Error traces are full of useful informa

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread Dick Moores
At 01:13 AM 10/27/2007, Alan Gauld wrote: >Take a look at my Event Driven programming topic. It contains a >simple key echo program using msvcrt and instructions for Linux >users to convert it to use curses. > > From that you should be able to create a dual platform version. Alan, I'm afraid I was

[Tutor] Build exe on Vista, have it run on XP?

2007-10-29 Thread Michael Langford
I'm trying to build a exe on a vista system using py2exe. It will deploy to vista and XP systems. If it matters, the application uses pyserial, as well. I have VS Studio 2005 installed on this laptop as well. I've found this so far that seems to be identical to what I'm seeing (for non-python progr

[Tutor] calculation with arrays: shape mismatch

2007-10-29 Thread John
Does anyone have an idea why I can't do this? for k in range(nr): contribution=N.zeros(shape(H['area'])) contribution=[contribution+grid[:,:,z:,k,0]/A for z in range(len(H['outheight']))] zplot[:,:,k]=zplot[:,:,k]+contribution; And on the interactive line: >>> shape(contribution) (360, 18

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread Dick Moores
At 07:54 AM 10/29/2007, Eric Brunson wrote: >Dick Moores wrote: >>At 05:03 AM 10/29/2007, bhaaluu wrote: >> >>>On 10/29/07, Dick Moores <[EMAIL PROTECTED]> wrote: >>> Seems I should clarify that. I'm not looking for a script that echoes the key pressed. So I'll change that last line to "Cou

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread Eric Brunson
Dick Moores wrote: > At 05:03 AM 10/29/2007, bhaaluu wrote: > >> On 10/29/07, Dick Moores <[EMAIL PROTECTED]> wrote: >> >>> Seems I should clarify that. I'm not looking for a script that echoes >>> the key pressed. So I'll change that last line to "Could you show a >>> script using it that,

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread Dick Moores
At 05:03 AM 10/29/2007, bhaaluu wrote: >On 10/29/07, Dick Moores <[EMAIL PROTECTED]> wrote: > > Seems I should clarify that. I'm not looking for a script that echoes > > the key pressed. So I'll change that last line to "Could you show a > > script using it that, say, prints "Hello" if '1' is pres

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread bhaaluu
On 10/29/07, Dick Moores <[EMAIL PROTECTED]> wrote: > Seems I should clarify that. I'm not looking for a script that echoes > the key pressed. So I'll change that last line to "Could you show a > script using it that, say, prints "Hello" if '1' is pressed and > "Bye" if '2' is, AND uses >

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread Kent Johnson
Dick Moores wrote: > At 03:44 AM 10/29/2007, Kent Johnson wrote: >> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/134892 > > Kent, I'm still too dumb to see how to use that. Could you show a > script using it that, say, prints 1 if '1' is pressed and 2 if '2' is? from getch_recipe imp

Re: [Tutor] system call

2007-10-29 Thread Kent Johnson
James wrote: > The subprocess module is meant to replace spawn, popen2, os.system() > etc. if I'm not mistaken. Yes. > Take a look at this excellent resource I've used numerous times: > > http://www.python.org/dev/peps/pep-0324/ The same information (with better format but split between mult

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread Dick Moores
At 04:08 AM 10/29/2007, Dick Moores wrote: >At 03:44 AM 10/29/2007, Kent Johnson wrote: > >http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/134892 > >Kent, I'm still too dumb to see how to use that. Could you show a >script using it that, say, prints 1 if '1' is pressed and 2 if '2' is? Se

Re: [Tutor] question re type()

2007-10-29 Thread Kent Johnson
Aditya Lal wrote: > or use types module > > import types > > if type(n) == types.IntType or type(n) == types.LongType : > blah! A few notes: - If you look at types.py, you find IntType = int LongType = long and so on for all the built-in types, so there is no need or advantage to importin

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread bhaaluu
# tty-example-2.py # Tue Oct 19 09:07:14 CEST 1999 # Fredrik Lundh fredrik at pythonware.com # http://mail.python.org/pipermail/python-list/1999-October/014151.html import sys try: # windows or dos import msvcrt getkey = msvcrt.getch except ImportError: # assume unix import tty

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread Dick Moores
At 03:44 AM 10/29/2007, Kent Johnson wrote: >http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/134892 Kent, I'm still too dumb to see how to use that. Could you show a script using it that, say, prints 1 if '1' is pressed and 2 if '2' is? Thanks, Dick __

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread Kent Johnson
Dick Moores wrote: > OK, here's a short script, which runs fine on Windows. What do I add > to have it run on unix as well? > > #!/usr/bin/env python > #coding=utf-8 > > try: > # windows or dos > import msvcrt > while True: > if msvcrt.kbhit(): > key = msvcrt