Re: extracting string.Template substitution placeholders

2014-01-12 Thread Steven D'Aprano
On Sun, 12 Jan 2014 10:08:31 -0500, Eric S. Johansson wrote: > As part of speech recognition accessibility tools that I'm building, I'm > using string.Template. In order to construct on-the-fly grammar, I need > to know all of the identifiers before the template is filled in. what is > the best wa

Re: efficient way to process data

2014-01-12 Thread Chris Angelico
On Mon, Jan 13, 2014 at 2:35 PM, Larry Martell wrote: > Thanks for the reply. I'm going to take a stab at removing the group > by and doing it all in python. It doesn't look too hard, but I don't > know how it will perform. Well, if you can't switch to PostgreSQL or such, then doing it in Python

Re: efficient way to process data

2014-01-12 Thread Larry Martell
On Sun, Jan 12, 2014 at 6:27 PM, Chris Angelico wrote: > On Mon, Jan 13, 2014 at 6:23 AM, Larry Martell > wrote: >> I have an python app that queries a MySQL DB. The query has this form: >> >> SELECT a, b, c, d, AVG(e), STD(e), CONCAT(x, ',', y) as f >> FROM t >> GROUP BY a, b, c, d, f >> >> x a

Re: efficient way to process data

2014-01-12 Thread Larry Martell
On Sun, Jan 12, 2014 at 5:43 PM, Dennis Lee Bieber wrote: > On Sun, 12 Jan 2014 14:23:17 -0500, Larry Martell > declaimed the following: > >>I have an python app that queries a MySQL DB. The query has this form: >> >>SELECT a, b, c, d, AVG(e), STD(e), CONCAT(x, ',', y) as f >>FROM t >>GROUP BY a,

Re: efficient way to process data

2014-01-12 Thread Larry Martell
On Sun, Jan 12, 2014 at 5:18 PM, Chris Angelico wrote: > On Mon, Jan 13, 2014 at 6:53 AM, Petite Abeille > wrote: >> On Jan 12, 2014, at 8:23 PM, Larry Martell wrote: >> >>> AFAIK, there is no way to do this in SQL. >> >> Sounds like a job for window functions (aka analytic functions) [1][2]. >

Re: efficient way to process data

2014-01-12 Thread Larry Martell
On Sun, Jan 12, 2014 at 2:53 PM, Petite Abeille wrote: > > On Jan 12, 2014, at 8:23 PM, Larry Martell wrote: > >> AFAIK, there is no way to do this in SQL. > > Sounds like a job for window functions (aka analytic functions) [1][2]. > > [1] http://www.postgresql.org/docs/9.3/static/tutorial-window

Re: Problem writing some strings (UnicodeEncodeError)

2014-01-12 Thread Paulo da Silva
Em 12-01-2014 20:29, Peter Otten escreveu: > Paulo da Silva wrote: > >>> but I have not tried it myself. Also, some bytes may need to be escaped, >>> either to be understood by the shell, or to address security concerns: >>> >> >> Since I am puting the file names between "", the only char that nee

Re: efficient way to process data

2014-01-12 Thread Chris Angelico
On Mon, Jan 13, 2014 at 6:23 AM, Larry Martell wrote: > I have an python app that queries a MySQL DB. The query has this form: > > SELECT a, b, c, d, AVG(e), STD(e), CONCAT(x, ',', y) as f > FROM t > GROUP BY a, b, c, d, f > > x and y are numbers (378.18, 2213.797 or 378.218, 2213.949 or > 10053.4

Re: Python example source code

2014-01-12 Thread Denis McMahon
On Sun, 12 Jan 2014 06:37:18 -0800, ngangsia akumbo wrote: > where can i find example source code by topic? > Any help please You don't want to be looking at source code yet, you want to be talking to the users of the system you're trying to design to find out what their requirements are. --

Re: efficient way to process data

2014-01-12 Thread Chris Angelico
On Mon, Jan 13, 2014 at 6:53 AM, Petite Abeille wrote: > On Jan 12, 2014, at 8:23 PM, Larry Martell wrote: > >> AFAIK, there is no way to do this in SQL. > > Sounds like a job for window functions (aka analytic functions) [1][2]. That's my thought too. I don't think MySQL has them, though, so it

Re: Python: 404 Error when trying to login a webpage by using 'urllib' and 'HTTPCookieProcessor'

2014-01-12 Thread Terry Reedy
On 1/12/2014 7:17 AM, KMeans Algorithm wrote: But I get a "404" error (Not Found). The page "https://www.mysite.com/loginpage"; does exist Firefox tells me the same thing. If that is a phony address, you should have said so. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/

Re: Problem writing some strings (UnicodeEncodeError)

2014-01-12 Thread Peter Otten
Paulo da Silva wrote: >> but I have not tried it myself. Also, some bytes may need to be escaped, >> either to be understood by the shell, or to address security concerns: >> > > Since I am puting the file names between "", the only char that needs to > be escaped is the " itself. What about the

Re: efficient way to process data

2014-01-12 Thread Petite Abeille
On Jan 12, 2014, at 8:23 PM, Larry Martell wrote: > AFAIK, there is no way to do this in SQL. Sounds like a job for window functions (aka analytic functions) [1][2]. [1] http://www.postgresql.org/docs/9.3/static/tutorial-window.html [2] http://docs.oracle.com/cd/E11882_01/server.112/e26088/fu

Re: Problem writing some strings (UnicodeEncodeError)

2014-01-12 Thread Paulo da Silva
> > I think instead of the hard way sketched out above it will be sufficient to > specify the error handler when opening the destination file > > shf = open(bashfilename, 'w', errors="surrogateescape") This seems to fix everything! I tried with a small test set and it worked. > > but I have no

python query on firebug extention

2014-01-12 Thread JAI PRAKASH SINGH
hello i am working on selenium module of python, i know how to make extension of firebug with selenium, but i want to know how to use firebug extension with request module / mechanize . i search a lot but unable to find it , please help . i want technique similar like :- from seleniu

efficient way to process data

2014-01-12 Thread Larry Martell
I have an python app that queries a MySQL DB. The query has this form: SELECT a, b, c, d, AVG(e), STD(e), CONCAT(x, ',', y) as f FROM t GROUP BY a, b, c, d, f x and y are numbers (378.18, 2213.797 or 378.218, 2213.949 or 10053.490, 2542.094). The business issue is that if either x or y in 2 rows

Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined?

2014-01-12 Thread Grant Edwards
On 2014-01-11, pintreo mardi wrote: > Hi, I've just begun to learn programming, I have an open question for > the group: Is the Python language an all in one computer language > which could replace C, C++, Java etc.. No. Python can not replace C in a number of application areas: * Bare-metal

Re: Problem writing some strings (UnicodeEncodeError)

2014-01-12 Thread Peter Otten
Paulo da Silva wrote: > Em 12-01-2014 16:23, Peter Otten escreveu: >> Paulo da Silva wrote: >> >>> I am using a python3 script to produce a bash script from lots of >>> filenames got using os.walk. >>> >>> I have a template string for each bash command in which I replace a >>> special string with

Re: python first project

2014-01-12 Thread MRAB
On 2014-01-12 06:04, Chris Angelico wrote: On Sun, Jan 12, 2014 at 4:14 PM, ngangsia akumbo wrote: What options do you think i can give the Ceo. Because from what you have outline, i think i will like to follow your advice. If it is just some recording data stuff then some spreadsheet can do t

Re: 'Straße' ('Strasse') and Python 2

2014-01-12 Thread MRAB
On 2014-01-12 08:31, Peter Otten wrote: wxjmfa...@gmail.com wrote: sys.version 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] s = 'Straße' assert len(s) == 6 assert s[5] == 'e' jmf Signifying nothing. (Macbeth) Python 2.7.2+ (default, Jul 20 2012, 22:15:08) [GCC 4.6.

Re: Problem writing some strings (UnicodeEncodeError)

2014-01-12 Thread Paulo da Silva
Em 12-01-2014 16:23, Peter Otten escreveu: > Paulo da Silva wrote: > >> I am using a python3 script to produce a bash script from lots of >> filenames got using os.walk. >> >> I have a template string for each bash command in which I replace a >> special string with the filename and then write the

Re: Python example source code

2014-01-12 Thread memilanuk
On 01/12/2014 06:37 AM, ngangsia akumbo wrote: where can i find example source code by topic? Any help please nullege.com is usually helpful... -- https://mail.python.org/mailman/listinfo/python-list

Data peeping function?

2014-01-12 Thread Thor Whalen
The first thing I do once I import new data (as a pandas dataframe) is to .head() it, .describe() it, and then kick around a few specific stats according to what I see. But I'm not satisfied with .describe(). Amongst others, non-numerical columns are ignored, and off-the-shelf stats will be com

Re: Python example source code

2014-01-12 Thread ngangsia akumbo
On Sunday, January 12, 2014 5:52:19 PM UTC+1, Emile van Sebille wrote: > On 01/12/2014 06:37 AM, ngangsia akumbo wrote: > > I'd recommend http://effbot.org/librarybook/ even though it's v2 specific and somewhat dated. Thank very much , it is very nice -- https://mail.python.org/mailman/lis

Re: Python example source code

2014-01-12 Thread ngangsia akumbo
On Sunday, January 12, 2014 5:38:03 PM UTC+1, Joel Goldstick wrote: > On Sun, Jan 12, 2014 at 10:13 AM, ngangsia akumbo wrote: > > Don't forget Python Module of the Week pymotw.com/ Thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: parametized unittest

2014-01-12 Thread CraftyTech
On Saturday, January 11, 2014 11:34:30 PM UTC-5, Roy Smith wrote: > In article , > > "W. Trevor King" wrote: > > > > > On Sat, Jan 11, 2014 at 08:00:05PM -0800, CraftyTech wrote: > > > > I'm finding it hard to use unittest in a for loop. Perhaps something > > > like: > > > > > > > > for

Re: Problem writing some strings (UnicodeEncodeError)

2014-01-12 Thread Emile van Sebille
On 01/12/2014 07:36 AM, Paulo da Silva wrote: Hi! I am using a python3 script to produce a bash script from lots of filenames got using os.walk. I have a template string for each bash command in which I replace a special string with the filename and then write the command to the bash script fil

Re: Python example source code

2014-01-12 Thread Emile van Sebille
On 01/12/2014 06:37 AM, ngangsia akumbo wrote: where can i find example source code by topic? I'd recommend http://effbot.org/librarybook/ even though it's v2 specific and somewhat dated. Emile -- https://mail.python.org/mailman/listinfo/python-list

Re: python first project

2014-01-12 Thread ngangsia akumbo
On Sunday, January 12, 2014 5:37:41 PM UTC+1, Emile van Sebille wrote: > On 01/11/2014 09:14 PM, ngangsia akumbo wrote: > For an example of a commercially available entry level alternative costs check out: > That said, it wouldn't surprise me that the CEO hasn't already looked int

Re: python first project

2014-01-12 Thread Emile van Sebille
On 01/11/2014 09:14 PM, ngangsia akumbo wrote: From all indication it is a very huge project. Yep -- I built such a system in the late 70's with a team of seven over two-three years. Then modifications and improvements continued over the next 20 years keeping about 2-4 programmers busy ful

Re: Python example source code

2014-01-12 Thread Joel Goldstick
On Sun, Jan 12, 2014 at 10:13 AM, ngangsia akumbo wrote: > > On Sunday, January 12, 2014 4:06:13 PM UTC+1, Dave Angel wrote: > > ngangsia akumbo Wrote in message: > > > > > Thanks bro > > -- > https://mail.python.org/mailman/listinfo/python-list Don't forget Python Module of the Week pymotw.co

Re: Problem writing some strings (UnicodeEncodeError)

2014-01-12 Thread Peter Otten
Paulo da Silva wrote: > I am using a python3 script to produce a bash script from lots of > filenames got using os.walk. > > I have a template string for each bash command in which I replace a > special string with the filename and then write the command to the bash > script file. > > Something

Re: Problem writing some strings (UnicodeEncodeError)

2014-01-12 Thread Albert-Jan Roskam
On Sun, 1/12/14, Paulo da Silva wrote: Subject: Problem writing some strings (UnicodeEncodeError) To: python-list@python.org Date: Sunday, January 12, 2014, 4:36 PM Hi! I am using a python3 script to produce a bash script from lots of filena

Problem writing some strings (UnicodeEncodeError)

2014-01-12 Thread Paulo da Silva
Hi! I am using a python3 script to produce a bash script from lots of filenames got using os.walk. I have a template string for each bash command in which I replace a special string with the filename and then write the command to the bash script file. Something like this: shf=open(bashfilename,

Re: Python: 404 Error when trying to login a webpage by using 'urllib' and 'HTTPCookieProcessor'

2014-01-12 Thread xDog Walker
On Sunday 2014 January 12 04:42, Chris Angelico wrote: > As a last resort, try firing up Wireshark or something and watch > exactly what gets sent and received. I went looking through the docs > for a "verbose" mode or a "debug" setting but can't find one - that'd > be ideal if it exists, though.

Re: Python example source code

2014-01-12 Thread ngangsia akumbo
On Sunday, January 12, 2014 4:06:13 PM UTC+1, Dave Angel wrote: > ngangsia akumbo Wrote in message: > Thanks bro -- https://mail.python.org/mailman/listinfo/python-list

extracting string.Template substitution placeholders

2014-01-12 Thread Eric S. Johansson
As part of speech recognition accessibility tools that I'm building, I'm using string.Template. In order to construct on-the-fly grammar, I need to know all of the identifiers before the template is filled in. what is the best way to do this? can string.Template handle recursive expansion i.e.

Dawkins arrested

2014-01-12 Thread Thrinassodon
>BREAKING NEWS! > THRINAXODON SPEARHEADED THE ASSAULT ON RICHARD DAWKINS, KNOWN FOR SUPPRESSION OF VALID RESEARCH OF HUMAN ORIGINS FOR YEARS, JUST TO GET A BUCK OUT OF BRAINWASHING CHILDREN'S LIVES INTO THE SCAM OF EVOLUTION. > Dawkins was charged with OVER 900

Re:Python example source code

2014-01-12 Thread Dave Angel
ngangsia akumbo Wrote in message: > where can i find example source code by topic? > Any help please > http://code.activestate.com/recipes/langs/python/ http://code.activestate.com/recipes/sets/2-python-cookbook-edition-2/ http://shop.oreilly.com/product/mobile/0636920027072.do http://www.mi

Re: Python example source code

2014-01-12 Thread bob gailer
On 1/12/2014 9:37 AM, ngangsia akumbo wrote: where can i find example source code by topic? There are several Python tutorials on the internet. They have good code examples. Most modules also have module-specific examples. There are also some web sites that may address your needs. I will leav

Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined?

2014-01-12 Thread Chris Angelico
On Mon, Jan 13, 2014 at 1:36 AM, Rotwang wrote: > On 12/01/2014 05:58, Chris Angelico wrote: >> >> (BTW, is there no better notation than six nested for/range for doing >> 6d6? I couldn't think of one off-hand, but it didn't really much >> matter anyway.) > > > If you're willing to do an import, t

Python example source code

2014-01-12 Thread ngangsia akumbo
where can i find example source code by topic? Any help please -- https://mail.python.org/mailman/listinfo/python-list

Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined?

2014-01-12 Thread Rotwang
On 12/01/2014 05:58, Chris Angelico wrote: [...] (BTW, is there no better notation than six nested for/range for doing 6d6? I couldn't think of one off-hand, but it didn't really much matter anyway.) If you're willing to do an import, then how about this: >>> from itertools import product >>>

Re: [ANN] Oktest.py 0.12.0 released - a new-style testing library

2014-01-12 Thread Roy Smith
In article , Makoto Kuwata wrote: > Hi, > > I released Oktest 0.12.0. > https://pypi.python.org/pypi/Oktest/ Wow, this looks neat. We use nose, but I'm thinking your ok() style exceptions should work just fine with nose. Just the notational convenience alone is worth it. Typing "ok(x) <=

Re: Python: 404 Error when trying to login a webpage by using 'urllib' and 'HTTPCookieProcessor'

2014-01-12 Thread Chris Angelico
On Sun, Jan 12, 2014 at 11:17 PM, KMeans Algorithm wrote: > The page "https://www.mysite.com/loginpage"; does exist PS. If it's not an intranet site and the URL isn't secret, it'd help if we could actually try things out. One of the tricks I like to use is to access the same page with a different

Re: Python: 404 Error when trying to login a webpage by using 'urllib' and 'HTTPCookieProcessor'

2014-01-12 Thread Chris Angelico
On Sun, Jan 12, 2014 at 11:17 PM, KMeans Algorithm wrote: > What am I doing wrong? Thank you very much. I can't say what's actually wrong, but I have a few ideas for getting more information out of the system... > opener = urllib2.build_opener(urllib2.HTTPCookieProcessor()) You don't do anythin

[ANN] Oktest.py 0.12.0 released - a new-style testing library

2014-01-12 Thread Makoto Kuwata
Hi, I released Oktest 0.12.0. https://pypi.python.org/pypi/Oktest/ Oktest is a new-style testing library for Python. ## unittest self.assertEqual(x, y) self.assertNotEqual(x, y) self.assertGreaterEqual(x, y) self.assertIsInstance(obj, cls) self.assertRegexpMatches(text, r

Re: 'Straße' ('Strasse') and Python 2

2014-01-12 Thread Mark Lawrence
On 12/01/2014 09:00, Stefan Behnel wrote: Peter Otten, 12.01.2014 09:31: wxjmfa...@gmail.com wrote: sys.version 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] s = 'Straße' assert len(s) == 6 assert s[5] == 'e' jmf Signifying nothing. (Macbeth) Python 2.7.2+ (default

Python: 404 Error when trying to login a webpage by using 'urllib' and 'HTTPCookieProcessor'

2014-01-12 Thread KMeans Algorithm
I'm trying to log in a webpage by using 'urllib' and this piece of code - import urllib2,urllib,os opener = urllib2.build_opener(urllib2.HTTPCookieProcessor()) login = urllib.urlencode({'username':'john', 'password':'foo'}) url = "https://www.mysite.com/loginpage"; req = urllib2.Request(u

Re: 'Straße' ('Strasse') and Python 2

2014-01-12 Thread Ned Batchelder
On 1/12/14 2:50 AM, wxjmfa...@gmail.com wrote: sys.version 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] s = 'Straße' assert len(s) == 6 assert s[5] == 'e' jmf Dumping random snippets of Python sessions here is useless. If you are trying to make a point, you have to

[newbie] starting geany from within idle does not work

2014-01-12 Thread Jean Dupont
I'm using the latest Raspbian on a Raspberry Pi and I'd like to start IDLE so that it uses Geany instead of Leafpad. This seems at first sight a trivial task: Perform a rightmouse click on the IDLE-icon-->Open with: Geany (in stead of the default Leafpad)-->OK LXTerminal-->lxpanelctl restart How

The war on Leakey is over.

2014-01-12 Thread Thrinassodon
=== >BREAKING NEWS! === > IT WAS A DARK AND STORMY NIGHT, RICHARD LEAKEY and Peter Nyikos, Paul Gans, and Desertphile were scoping Thrinaxodon's house for signs of the Devonian human fossils to burn them and save the from being broke by burning the fossils and keeping the

Re: 'Straße' ('Strasse') and Python 2

2014-01-12 Thread Stefan Behnel
Peter Otten, 12.01.2014 09:31: > wxjmfa...@gmail.com wrote: > >> >>> sys.version >> 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] >> >>> s = 'Straße' >> >>> assert len(s) == 6 >> >>> assert s[5] == 'e' >> >>> >> >> jmf > > Signifying nothing. (Macbeth) > > Python 2.7.2+ (def

Re: 'Straße' ('Strasse') and Python 2

2014-01-12 Thread Peter Otten
wxjmfa...@gmail.com wrote: sys.version > 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] s = 'Straße' assert len(s) == 6 assert s[5] == 'e' > > jmf Signifying nothing. (Macbeth) Python 2.7.2+ (default, Jul 20 2012, 22:15:08) [GCC 4.6.1] on linux2 Ty