Re: Syntactic structure for 'until :' loop

2011-01-12 Thread Peter Otten
Ian Kelly wrote: > reader_iter = iter(self.reader) > headers = reader_iter.next() > # intermediate code > for line in reader_iter: > data.append(line) > return data If data is a list the for loop can be replaced with data.extend(reader_iter) or, if data is an empty list created within the

read text color from image

2011-01-12 Thread prakash jp
Hi All, During automation of a test case the web interface throws failure and sucess text in RED and GREEN colors respectively. Is there a method to read the color of the Success(green) and Failure(red) from the screenshots of the webinterfaces collect for Failure and Success say : import Image

Re: Python use growing fast

2011-01-12 Thread Colin J. Williams
On 10-Jan-11 16:02 PM, MRAB wrote: On 10/01/2011 20:29, Dan Stromberg wrote: I invite folks to check out Tiobe's Language Popularity Rankings: http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html The gist is: Python grew faster than any other programming language over the last year

Career path - where next?

2011-01-12 Thread Alan Harris-Reid
Hi there, I wonder if any Python folk out there can help me. For many years I was a contractor developing desktop and web applications using Visual Foxpro as my main language, with Foxpro, SQL-server and Oracle as back-end databases. Unfortunately Foxpro was killed-off by Microsoft, hence my

Re: Career path - where next?

2011-01-12 Thread Terry Reedy
On 1/12/2011 11:37 AM, Alan Harris-Reid wrote: ... updating my programming skills by learning Python (3) with SQLite, JavaScript, HTML and CSS to a level where I can create and deploy data-based web-sites. ... I would even consider doing small projects for nothing so that I can 'get my foot in

Re: Python use growing fast

2011-01-12 Thread Terry Reedy
On 1/12/2011 9:51 AM, Colin J. Williams wrote: It shows an example of Python code, which happens to have 2 syntax errors! Why not correct the Wikipedia entry? As I reported early, the errors, if any, are in .png and .svg images of text, which would have to be replaced, not corrected. Would

Re: Ideas for a module to process command line arguments

2011-01-12 Thread Alice Bevan–McGregor
On 2011-01-11 21:41:24 -0800, Michele Simionato said: Originally plac too was able to recognize flags automatically by looking at the default value (if the default value is a boolean then the option is a flag); however I removed that functionality because I wanted to be able to differentiate b

Re: Python use growing fast

2011-01-12 Thread Krzysztof Bieniasz
> As I reported early, the errors, if any, are in .png and .svg images of > text, which would have to be replaced, not corrected. Would be good > since the imaged snippet is a haphazard except from a much larger file > and inane out of context. I don't think it really is a big deal. I mean, this i

Re: Career path - where next?

2011-01-12 Thread Jon Clements
On Jan 12, 4:37 pm, Alan Harris-Reid wrote: > Hi there, I wonder if any Python folk out there can help me. > > For many years I was a contractor developing desktop and web > applications using Visual Foxpro as my main language, with Foxpro, > SQL-server and Oracle as back-end databases.  Unfortuna

Re: Career path - where next?

2011-01-12 Thread Philip Semanchuk
On Jan 12, 2011, at 11:37 AM, Alan Harris-Reid wrote: > > Hi there, I wonder if any Python folk out there can help me. > > For many years I was a contractor developing desktop and web applications > using Visual Foxpro as my main language, with Foxpro, SQL-server and Oracle > as back-end data

Best way to automatically copy out attachments from an email

2011-01-12 Thread Matty Sarro
As of now here is my situation: I am working on a system to aggregate IT data and logs. A number of important data are gathered by a third party system. The only immediate way I have to access the data is to have their system automatically email me updates in CSV format every hour. If I set up a ma

How to populate all possible hierarchical clusterings from a set of elements?

2011-01-12 Thread justin
The title sounds too complex, but my question is actually simple. Suppose I have [1,2,3,4,5], then there are many ways of making clustering. Among them, I want to pair up terminals until there is only one left at the end. For example, 1,2),3),4),5), (1,(2,(3,(4,5, or (((1,2),(3,4)), 5) wou

Nested structures question

2011-01-12 Thread Physics Python
Hello, I am teaching myself python using the book: Python Programming for Absolute Beginners, 2nd edition by Michael Dawson. I am using python 2.7.1. In chapter 3 we are learning to use structures (while, if, elif) to write a program that has the user guess a number between 1 and 100. Here is

Re: Nested structures question

2011-01-12 Thread Tim Harig
On 2011-01-12, Physics Python wrote: > while guess != the_number: = > while tries > 7: > if guess > the_number: > print "Lower..." > else: > print "Higher..." > guess = int(raw_input("Take a guess:

Re: Python use growing fast

2011-01-12 Thread Grant Edwards
On 2011-01-12, Terry Reedy wrote: > On 1/12/2011 9:51 AM, Colin J. Williams wrote: > >>> It shows an example of Python code, which happens to have 2 syntax >>> errors! >> >> Why not correct the Wikipedia entry? > > As I reported early, the errors, if any, are in .png and .svg images of > text, wh

Re: Nested structures question

2011-01-12 Thread Physics Python
Thanks, Is this an indentation problem then? How do I update the sentinel within the secondary while loop. I am trying to avoid using breaks by the way, as I can program this example using breaks: --- start--- import random print "\tWelcome to 'Guess my number'!:" print "\nI'm thinking of a numb

Re: order of importing modules

2011-01-12 Thread Catherine Moroney
I've looked at my sys.path variable and I see that it has a whole bunch of site-package directories, followed by the contents of my $PYTHONPATH variable, followed by a list of misc site-package variables (see below). I've verified that if I manually reverse the order of sys.path I can then import

Re: order of importing modules

2011-01-12 Thread Catherine Moroney
I've looked at my sys.path variable and I see that it has a whole bunch of site-package directories, followed by the contents of my $PYTHONPATH variable, followed by a list of misc site-package variables (see below). I've verified that if I manually reverse the order of sys.path I can then import

RE: Nested structures question

2011-01-12 Thread Jason Staudenmayer
Return False instead of break should work else: print "You guessed it! The number was", the_number print "And it only took you", tries, "tries!\n" return False Jason ..·><º> > -Original Message- > From: > python-list-bounces+jasons=adventureaquarium.

Re: Nested structures question

2011-01-12 Thread Tim Harig
[wrapped lines to <80 characters per RFC 1855] On 2011-01-12, Physics Python wrote: > Is this an indentation problem then? That depends how you look at it. I was not clear from your code exactly where you wanted to handle things. > How do I update the sentinel within the secondary while loop. I

Re: Nested structures question

2011-01-12 Thread Tim Harig
On 2011-01-12, Jason Staudenmayer wrote: > Return False instead of break should work > > else: > print "You guessed it! The number was", the_number > print "And it only took you", tries, "tries!\n" > return False Since he isn't in a function, that isn't any good. He wo

Re: How to populate all possible hierarchical clusterings from a set of elements?

2011-01-12 Thread Peter Otten
justin wrote: > The title sounds too complex, but my question is actually simple. > > Suppose I have [1,2,3,4,5], then there are many ways of making > clustering. > Among them, I want to pair up terminals until there is only one left > at the end. > For example, 1,2),3),4),5), (1,(2,(3,(4,5))

How to Buffer Serialized Objects to Disk

2011-01-12 Thread Scott McCarty
Sorry to ask this question. I have search the list archives and googled, but I don't even know what words to find what I am looking for, I am just looking for a little kick in the right direction. I have a Python based log analysis program called petit ( http://crunchtools.com/petit). I am trying

Re: Python use growing fast

2011-01-12 Thread Alice Bevan–McGregor
On 2011-01-10 19:49:47 -0800, Roy Smith said: One of the surprising (to me, anyway) uses of JavaScript is as the scripting language for MongoDB (http://www.mongodb.org/). I just wish they'd drop spidermonkey and go with V8 or another, faster and more modern engine. :( - Alice. --

Re: order of importing modules

2011-01-12 Thread Chris Rebert
> Dan Stromberg wrote: >> On Tue, Jan 11, 2011 at 4:30 PM, Catherine Moroney >> wrote: >>> >>> In what order does python import modules on a Linux system?  I have a >>> package that is both installed in /usr/lib64/python2.5/site-packages, >>> and a newer version of the same module in a working dir

Re: How to Buffer Serialized Objects to Disk

2011-01-12 Thread MRAB
On 12/01/2011 21:05, Scott McCarty wrote: Sorry to ask this question. I have search the list archives and googled, but I don't even know what words to find what I am looking for, I am just looking for a little kick in the right direction. I have a Python based log analysis program called petit (

Re: How to Buffer Serialized Objects to Disk

2011-01-12 Thread Chris Rebert
On Wed, Jan 12, 2011 at 1:05 PM, Scott McCarty wrote: > Sorry to ask this question. I have search the list archives and googled, but > I don't even know what words to find what I am looking for, I am just > looking for a little kick in the right direction. > I have a Python based log analysis prog

Re: How to Buffer Serialized Objects to Disk

2011-01-12 Thread Peter Otten
Scott McCarty wrote: > Sorry to ask this question. I have search the list archives and googled, > but I don't even know what words to find what I am looking for, I am just > looking for a little kick in the right direction. > > I have a Python based log analysis program called petit ( > http://cr

Re: Best way to automatically copy out attachments from an email

2011-01-12 Thread Chris Rebert
On Wed, Jan 12, 2011 at 10:59 AM, Matty Sarro wrote: > As of now here is my situation: > I am working on a system to aggregate IT data and logs. A number of > important data are gathered by a third party system. The only > immediate way I have to access the data is to have their system > automatic

Re: Parsing string for " "

2011-01-12 Thread Aahz
In article <0d7143ca-45cf-44c3-9e8d-acb867c52...@f30g2000yqa.googlegroups.com>, Daniel da Silva wrote: > >I have come across a task where I would like to scan a short 20-80 >character line of text for instances of " ". Ideally > could be of any tense. In Soviet Russia, you! -- Aahz (a...@pyth

Re: Nested structures question

2011-01-12 Thread Tim Harig
In case you still need help: - # Set the initial values - the_number= random.randrange(100) + 1 - tries = 0 - guess = None - - # Guessing loop - while guess != the_number and tries < 7: - guess = int(raw_input("Take a guess: ")) - if guess > the_number: - print "Lower..." -

Re: How to Buffer Serialized Objects to Disk

2011-01-12 Thread Scott McCarty
Been digging ever since I posted this. I suspected that the response might be use a database. I am worried I am trying to reinvent the wheel. The problem is I don't want any dependencies and I also don't need persistence program runs. I kind of wanted to keep the use of petit very similar to cat, h

Re: How can I find the remainder when dividing 2 integers

2011-01-12 Thread Rohan Pai
Try using dividend % divisor, this will return the remainder Rohan Pai -- http://mail.python.org/mailman/listinfo/python-list

Re: How to Buffer Serialized Objects to Disk

2011-01-12 Thread Peter Otten
Scott McCarty wrote: > Been digging ever since I posted this. I suspected that the response might > be use a database. I am worried I am trying to reinvent the wheel. The > problem is I don't want any dependencies and I also don't need persistence > program runs. I don't think sqlite3 counts as

Re: How to Buffer Serialized Objects to Disk

2011-01-12 Thread Adam Tauno Williams
On Wed, 2011-01-12 at 17:29 -0500, Scott McCarty wrote: > Been digging ever since I posted this. I suspected that the response > might be use a database. I use shelve extensively; there are many use-cases where it makes sense. And there are many where a database makes sense. Basically, if I just

Re: Python use growing fast

2011-01-12 Thread Roy Smith
In article , Alice Bevan­McGregor wrote: > On 2011-01-10 19:49:47 -0800, Roy Smith said: > > > One of the surprising (to me, anyway) uses of JavaScript is as the > > scripting language for MongoDB (http://www.mongodb.org/). > > I just wish they'd drop spidermonkey and go with V8 or another, f

cipher encoding

2011-01-12 Thread Cathy James
Dear all, I hope someone out there can help me. The output string of my code is close to what i need, but i need it 1)printed on one line and 2) reversed #mycode: s= input("Enter message: ") key=1 for letter in s: num=(chr(ord(letter)+1)) print(num) #or is there a better way to rewrite

Re: cipher encoding

2011-01-12 Thread Corey Richardson
On 01/12/2011 07:35 PM, Cathy James wrote: > Dear all, > > I hope someone out there can help me. > > The output string of my code is close to what i need, but i need it > 1)printed on one line and > 2) reversed > > #mycode: > s= input("Enter message: ") > key=1 > for letter in s: > num=(

Re: cipher encoding

2011-01-12 Thread Corey Richardson
On 01/12/2011 07:39 PM, Corey Richardson wrote: > On 01/12/2011 07:35 PM, Cathy James wrote: >> Dear all, >> >> I hope someone out there can help me. >> >> The output string of my code is close to what i need, but i need it >> 1)printed on one line and >> 2) reversed >> >> #mycode: >> s= inp

Re: cipher encoding

2011-01-12 Thread Nick Stinemates
Try print s[::-1] Nick On Wednesday, January 12, 2011, Cathy James wrote: > Dear all, > > I hope someone out there can help me. > >  The output string of my code is close to what i need, but i need it > 1)printed on one line and > > 2) reversed > > > #mycode: > s= input("Enter message: ") > key

Re: cipher encoding

2011-01-12 Thread MRAB
On 13/01/2011 00:49, Corey Richardson wrote: On 01/12/2011 07:39 PM, Corey Richardson wrote: On 01/12/2011 07:35 PM, Cathy James wrote: Dear all, I hope someone out there can help me. The output string of my code is close to what i need, but i need it 1)printed on one line and 2) reversed

Re: Which coding style is better? public API or private method inside class definition

2011-01-12 Thread DevPlayer
On Jan 4, 11:46 pm, Inyeol wrote: > Which coding style do you prefer? I'm more toward public API way, > since it requires less code change if I refactor private data > structure later. > Plz give pros and cons of these. Great question. It gets at the heart of Python style. It's a tricky question

Re: order of importing modules

2011-01-12 Thread Dan Stromberg
I don't know where the site-packages directories are coming from - maybe a site.py or sitecustomize.py? Sometimes you can strace with a very large -s to see where something like this is coming from. -o is your friend for saving the output to a file in, EG, /tmp. What I usually do is to put speci

Re: order of importing modules

2011-01-12 Thread Ben Finney
(Please don't top-post replies. Instead, reply in-line with the quoted material, removing irrelevant material. An example is this message.) Catherine Moroney writes: > I've looked at my sys.path variable and I see that it has a whole > bunch of site-package directories, followed by the contents

The problem of 324 (net::ERR_EMPTY_RESPONSE)

2011-01-12 Thread shengli zhang
This is something I've been fighting for a couple of days. Let me try to describe it as I can. I use "python2.5 + django1.0 + mod_python + apache2" to develop a website. the website has run for two years. But the problem happend these days. when I log in my system, the first browser's sessin will

Re: Parsing string for " "

2011-01-12 Thread Daniel da Silva
MRAB, I will check it out. Thanks! Daniel On Tue, Jan 11, 2011 at 10:23 PM, MRAB wrote: > On 12/01/2011 01:50, Daniel da Silva wrote: > >> Hi, >> >> I have come across a task where I would like to scan a short 20-80 >> character line of text for instances of " ". Ideally >> could be of any

Re: Nested structures question

2011-01-12 Thread DevPlayer
looping = True while looping: guess = int(raw_input("Take a guess: ")) tries += 1 if guess > the_number: print "Lower..." elif guess < the_number: print "Higher..." else: print "You guessed it! The number was", the_number print "And it only took y