Re: [Tutor] cannot convert eps to png using PIL (LL)

2009-10-16 Thread LL
> It's trying to launch GhostScript, and failing. Not sure this is the problem. Ghostscript is installed on my machine. Also, I am able to convert .jpg to .png.___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http:/

Re: [Tutor] Most pythonic input validation

2009-10-16 Thread Dave Angel
Kent Johnson wrote: Is this the way to define my own error and to use it: class MyValueError(Exception): define initialization and printing You usually don't need to define anything extra, the Exception methods are fine. I think there could be confusion over what you meant w

Re: [Tutor] Tutorials and How important is pseudocode

2009-10-16 Thread Alan Gauld
"Katt" wrote The most recent one(with a few bug fixes etc) is as per my .sig... Thanks Alan G. I got the new version now. I will go back to the beginning and step through it again. No, you don;t need to do that, its mainly typos and stuff thats fixed. There is no radical changes. I am cur

Re: [Tutor] Tutorials and How important is pseudocode

2009-10-16 Thread Katt
Message: 7 Date: Fri, 16 Oct 2009 13:54:37 +0100 From: "Alan Gauld" To: tutor@python.org Subject: Re: [Tutor] PyWin32 - Library of functions to interact with windows Message-ID: Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response "Katt" wrote and Alan Gauld's

Re: [Tutor] Help with pexpect

2009-10-16 Thread Mark K. Zanfardino
Nathan, Depending upon how much control you have over the calling machine you can eliminate the pesky password prompt from ssh altogether by creating a private/public key pair for the client machine and copy the public key to the host machine. This way when you ssh to the host you will be authent

Re: [Tutor] Help with pexpect

2009-10-16 Thread vince spicer
On Fri, Oct 16, 2009 at 1:45 PM, Nathan Farrar wrote: > I'm trying to automate the collection of data to remote devices over > ssh via pexpect. I had originally attempted (with limited success) to > use paramiko, however due to cisco's ssh implimentation I cannot send > mulitple commands over the

[Tutor] Help with pexpect

2009-10-16 Thread Nathan Farrar
I'm trying to automate the collection of data to remote devices over ssh via pexpect. I had originally attempted (with limited success) to use paramiko, however due to cisco's ssh implimentation I cannot send mulitple commands over the same connection, which is absolutely essential. Therefore, I'

Re: [Tutor] way to see code execution in real-time?

2009-10-16 Thread Kent Johnson
On Fri, Oct 16, 2009 at 1:43 PM, Serdar Tumgoren wrote: > Hey everybody, > > Thanks for the recommendations -- I usually do use pdb to step through > chunks of code, but always by setting a breakpoint. And then I have to > "manually" print out the variables to see what's going on in the code. Win

Re: [Tutor] way to see code execution in real-time?

2009-10-16 Thread Serdar Tumgoren
Hey everybody, Thanks for the recommendations -- I usually do use pdb to step through chunks of code, but always by setting a breakpoint. And then I have to "manually" print out the variables to see what's going on in the code. Is there a way to wrestle pdb into spitting out the code being execut

Re: [Tutor] way to see code execution in real-time?

2009-10-16 Thread Alan Gauld
"Serdar Tumgoren" wrote I was wondering -- is there a way to "watch" a program execute by piping a report of its actions to standard output or to a file? There are tools for doing that - Look! - is one I know that works for C++ and Java but I don;t know iof any freware ones or that work fo

Re: [Tutor] way to see code execution in real-time?

2009-10-16 Thread Kent Johnson
On Fri, Oct 16, 2009 at 9:53 AM, Serdar Tumgoren wrote: > Hello everybody, > > I was wondering -- is there a way to "watch" a program execute by > piping a report of its actions to standard output or to a file? > Basically, I'd like to see the order that functions/methods are > executing as they h

Re: [Tutor] Most pythonic input validation

2009-10-16 Thread Kent Johnson
On Fri, Oct 16, 2009 at 9:44 AM, Robert Johansson wrote: > If I wanted prompt to be an integer, is my check with range still bad? If the prompt is coming from raw_input() then you have already guaranteed it is an integer when you convert it in a try/except block. > Is this the way to define my o

Re: [Tutor] way to see code execution in real-time?

2009-10-16 Thread Lowell Tackett
Try the "pdb" module--the python debugger. >From the virtual desk of Lowell Tackett  --- On Fri, 10/16/09, Serdar Tumgoren wrote: From: Serdar Tumgoren Subject: [Tutor] way to see code execution in real-time? To: "Python Tutor" Date: Friday, October 16, 2009, 9:53 AM Hello everybody, I wa

[Tutor] way to see code execution in real-time?

2009-10-16 Thread Serdar Tumgoren
Hello everybody, I was wondering -- is there a way to "watch" a program execute by piping a report of its actions to standard output or to a file? Basically, I'd like to see the order that functions/methods are executing as they happen, along with how long each one takes. Is this something cProfi

Re: [Tutor] Most pythonic input validation

2009-10-16 Thread Robert Johansson
> What if a valid user input has to be an integer between 10 and 20? I mean, > it could be that you are doing something that only makes sense for that > input. Would it be pythonic to add a test like: > > If prompt in range(10,21): Better to write if 10 <= prompt <= 20: >  ... > else: >  ... ra

Re: [Tutor] Understanding what the code does behind the scenes

2009-10-16 Thread Alan Gauld
"Dave Angel" wrote for text, color in color_items: #3 textcolor(color) #4 print text#5 Ah! Good call, I never thought of unpacking the tuple in the loop. Big improvement. It would be possible (and maybe even desirable) to write a differe

Re: [Tutor] Understanding what the code does behind the scenes

2009-10-16 Thread Alan Gauld
"Katt" wrote def colorPrint(strings): for string in strings: textcolor(string[1]) print string[0], In the above function please let me know if I am correct in my interpretation. The first line of course would be the defining of the function and puting something in the

Re: [Tutor] PyWin32 - Library of functions to interact with windows

2009-10-16 Thread Alan Gauld
"Katt" wrote and Alan Gauld's: Tutor - > May 27, 2007). Oops, thats the old Freenet version. The most recent one(with a few bug fixes etc) is as per my .sig... (The 3 yucky Geocities images at the top will be disappearing soon as I finally move the files to the new server and turn off t

Re: [Tutor] Most pythonic input validation

2009-10-16 Thread Alan Gauld
"Robert Johansson" wrote What if a valid user input has to be an integer between 10 and 20? Would it be pythonic to add a test like: If prompt in range(10,21): ... else: ... raise an error Yes and it could be a ValueError in this case. You could also test using conditions which, for a w

[Tutor] Oh no! Wrong advice!

2009-10-16 Thread Eike Welk
Well, my ideas weren't so good: On Friday 16 October 2009, Eike Welk wrote: > I have an other idea for a color function. It cam be embedded in > the print statement because it returns an empty string: > > > def color(color_num): > '''Change text color and return empty string.''' > textcolo

Re: [Tutor] Understanding what the code does behind the scenes

2009-10-16 Thread Kent Johnson
On Fri, Oct 16, 2009 at 7:21 AM, Dave Angel wrote: > My attempt at readability  (untested): > > def colorPrint(color_items):       #1 >   """Call this function to print one or more strings, each with >       a color number specified, to the console.  The argument >       is a list of items, where

Re: [Tutor] Understanding what the code does behind the scenes

2009-10-16 Thread Kent Johnson
On Fri, Oct 16, 2009 at 7:53 AM, Eike Welk wrote: > I have an other idea for a color function. It cam be embedded in the > print statement because it returns an empty string: > > > def color(color_num): >    '''Change text color and return empty string.''' >    textcolor(color_num) >    return ''

Re: [Tutor] Most pythonic input validation

2009-10-16 Thread Christian Witts
Robert Johansson wrote: Hi, I'm writing a text based menu and want to validate the user input. I'm giving the options as integers, and I want to make sure the user enters a proper value. Here's what I've got so far: http://pastebin.com/m1fdd5863 I'm most interested in this segment: while True

Re: [Tutor] Most pythonic input validation

2009-10-16 Thread Kent Johnson
On Fri, Oct 16, 2009 at 7:25 AM, Robert Johansson wrote: > What if a valid user input has to be an integer between 10 and 20? I mean, > it could be that you are doing something that only makes sense for that > input. Would it be pythonic to add a test like: > > If prompt in range(10,21): Better

Re: [Tutor] Most pythonic input validation

2009-10-16 Thread Robert Johansson
> Hi, > I'm writing a text based menu and want to validate the user input. I'm > giving the options as integers, and I want to make sure the user enters a > proper value. > Here's what I've got so far: http://pastebin.com/m1fdd5863 > I'm most interested in this segment: >     while True: >         

Re: [Tutor] Understanding what the code does behind the scenes

2009-10-16 Thread Eike Welk
On Friday 16 October 2009, Katt wrote: > > print "There are", > > textcolor(4) > > print apples_left, > > textcolor(7) > > print "left in the basket." > > The above code is very easy to understand when looking at it, but > from what I see of other programmers this would not be as pythonic. I think

Re: [Tutor] Understanding what the code does behind the scenes

2009-10-16 Thread Dave Angel
Katt wrote: The textcolor() function returns None. so you need to keep it out of your print statement:. This means you need to split your print into multiple separate statements. (This will also be true for the pywin32 version) print "There are", textcolor(4) print apples_left, textcolor(7) pri

Re: [Tutor] Putting a variable into a statement

2009-10-16 Thread Dave Angel
bob gailer wrote: GoodPotatoes wrote: : for x in myuser.properties:# "myuser.properties" returns a tuple of properties associated with the myuser AD object print myuser.x Traceback (most recent call last): File "", line 2, in print myuser.x File "build\bdist.win32\egg\active_

Re: [Tutor] Most pythonic input validation

2009-10-16 Thread Christian Witts
Katt wrote: Message: 3 Date: Thu, 15 Oct 2009 16:50:57 +0100 From: Rich Lovely To: Wayne Werner Cc: "tutor@python.org" Subject: Re: [Tutor] Most pythonic input validation Message-ID: Content-Type: text/plain; charset=windows-1252 2009/10/15 Wayne Werner : Hi, I'm writing a text based menu

Re: [Tutor] Understanding what the code does behind the scenes

2009-10-16 Thread Katt
Message: 3 Date: Thu, 15 Oct 2009 08:11:11 +0100 From: "Alan Gauld" To: tutor@python.org Subject: Re: [Tutor] Changing the color of text in the windows shell (WinXP/python 2.6.2) Message-ID: Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response The textcolor() func

Re: [Tutor] Most pythonic input validation

2009-10-16 Thread Katt
Message: 3 Date: Thu, 15 Oct 2009 16:50:57 +0100 From: Rich Lovely To: Wayne Werner Cc: "tutor@python.org" Subject: Re: [Tutor] Most pythonic input validation Message-ID: Content-Type: text/plain; charset=windows-1252 2009/10/15 Wayne Werner : Hi, I'm writing a text based menu and want to

Re: [Tutor] PyWin32 - Library of functions to interact with windows

2009-10-16 Thread Katt
Message: 4 Date: Thu, 15 Oct 2009 09:35:30 +0100 From: Tim Golden Cc: tutor@python.org Subject: Re: [Tutor] PyWin32 - Library of functions to interact with windows? Message-ID: <4ad6ded2.5040...@timgolden.me.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Katt wrote: Hello all,

Re: [Tutor] Changing the text color in the WinXP dos shell (WinXP/py2.6.2)

2009-10-16 Thread Katt
Date: Thu, 15 Oct 2009 08:11:11 +0100 From: "Alan Gauld" To: tutor@python.org Subject: Re: [Tutor] Changing the color of text in the windows shell (WinXP/python 2.6.2) Message-ID: "Katt" wrote lucky). So I will pursue all three types of changing color. First I will try WConio, next to be