Re: honking great ideas

2013-03-27 Thread Sean Felipe Wolfe
On Tue, Mar 26, 2013 at 7:25 PM, Ned Deily n...@acm.org wrote: One suggestion: take a look at Raymond Hettinger's keynote address from the recent PyCon. Any of Raymond's talks are worth viewing but this one in particular is a higher-level sales pitch for Python: Show the specific features

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
Τη Τετάρτη, 27 Μαρτίου 2013 6:26:06 π.μ. UTC+2, ο χρήστης ru...@yahoo.com έγραψε: If not, maybe you can try adding a print statement to your code that will print the value of 'page'. This will be easier to do if you can run you code interactively. If you have to run it via a webserver

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
And also i must show you that 'page' values are calculated by: # detect how 'index.html' is called and validate variables 'htmlpage' 'page' if page and os.path.isfile( '/home/nikos/www/cgi-bin/' + page ): page = page elif form.getvalue('show') and os.path.isfile( htmlpage ): page

Splitting a list into even size chunks in python?

2013-03-27 Thread Norah Jones
Hi, I have a list of arbitrary length, and I need to split it up into equal size chunks. There are some obvious ways to do this, like keeping a counter and two lists, and when the second list fills up, add it to the first list and empty the second list for the next round of data, but this is

Re: Sudoku

2013-03-27 Thread Ulrich Eckhardt
Am 27.03.2013 06:44, schrieb Eric Parry: I downloaded the following program from somewhere using a link from Wikipedia and inserted the “most difficult Sudoku puzzle ever” string into it and ran it. It worked fine and solved the puzzle in about 4 seconds. However I cannot understand how it

Re: I need a neat way to print nothing or a number

2013-03-27 Thread Wolfgang Maier
Chris Angelico rosuav at gmail.com writes: On Wed, Mar 27, 2013 at 4:06 AM, Wolfgang Maier wolfgang.maier at biologie.uni-freiburg.de wrote: Chris Angelico rosuav at gmail.com writes: Try printing out this expression: %.2f%value if value else '' Without the rest of your code I

Re: Splitting a list into even size chunks in python?

2013-03-27 Thread Peter Otten
Norah Jones wrote: I have a list of arbitrary length, and I need to split it up into equal size chunks. There are some obvious ways to do this, like keeping a counter and two lists, and when the second list fills up, add it to the first list and empty the second list for the next round of

True/False formats as 1/0 in a fixed width string

2013-03-27 Thread Frank Millman
Hi all This is a bit of trivia, really, as I don't need a solution. But someone might need it one day, so it is worth mentioning. '{}'.format(True) 'True' '{:10}'.format(True) '1 ' One might want to format True/False in a fixed width string, but it returns 1/0 instead. Is there any

Re: Sudoku

2013-03-27 Thread Damien Wyart
* Eric Parry joan4e...@gmail.com in comp.lang.python: I downloaded the following program from somewhere using a link from Wikipedia and inserted the “most difficult Sudoku puzzle ever” string into it and ran it. It worked fine and solved the puzzle in about 4 seconds. However I cannot

Re: Help me pick an API design (OO vs functional)

2013-03-27 Thread Michael Herrmann
On Tuesday, March 26, 2013 4:16:57 PM UTC+1, Chris Angelico wrote: On Wed, Mar 27, 2013 at 1:59 AM, Michael Herrmann michael.herrmann@... wrote: save_dialogue = press(CTRL + 's') Does every single API need to then consider the possibility of focus changing? How does the press() function

Re: True/False formats as 1/0 in a fixed width string

2013-03-27 Thread Peter Otten
Frank Millman wrote: '{}'.format(True) 'True' '{:10}'.format(True) '1 ' One might want to format True/False in a fixed width string, but it returns 1/0 instead. Is there any way to make this work? {!s:10}.format(True) 'True ' --

Re: True/False formats as 1/0 in a fixed width string

2013-03-27 Thread Dave Angel
On 03/27/2013 04:40 AM, Frank Millman wrote: Hi all This is a bit of trivia, really, as I don't need a solution. But someone might need it one day, so it is worth mentioning. '{}'.format(True) 'True' '{:10}'.format(True) '1 ' One might want to format True/False in a fixed width

Re: Help me pick an API design (OO vs functional)

2013-03-27 Thread Michael Herrmann
On Tuesday, March 26, 2013 5:41:42 PM UTC+1, Dave Angel wrote: On 03/26/2013 10:40 AM, Michael Herrmann wrote: On Tuesday, March 26, 2013 3:13:30 PM UTC+1, Neil Cerutti wrote: SNIP Have you considered adding a keyword argument to each of your global functions, which is normally None,

Re: True/False formats as 1/0 in a fixed width string

2013-03-27 Thread Frank Millman
On 27/03/2013 10:52, Peter Otten wrote: Frank Millman wrote: '{}'.format(True) 'True' '{:10}'.format(True) '1' One might want to format True/False in a fixed width string, but it returns 1/0 instead. Is there any way to make this work? {!s:10}.format(True) 'True' Works

Re: Help me pick an API design (OO vs functional)

2013-03-27 Thread Michael Herrmann
On Tuesday, March 26, 2013 11:01:08 PM UTC+1, Mitya Sirenef wrote: On 03/26/2013 10:59 AM, Michael Herrmann wrote: ... Forcing the library user to always use the with ... seems like overkill though. I think the gained precision does not justify this burden on the library user. Hm

Re: True/False formats as 1/0 in a fixed width string

2013-03-27 Thread Frank Millman
On 27/03/2013 10:55, Dave Angel wrote: On 03/27/2013 04:40 AM, Frank Millman wrote: Hi all This is a bit of trivia, really, as I don't need a solution. But someone might need it one day, so it is worth mentioning. '{}'.format(True) 'True' '{:10}'.format(True) '1 ' One might want

Re: Help me pick an API design (OO vs functional)

2013-03-27 Thread Michael Herrmann
On Tuesday, March 26, 2013 11:37:23 PM UTC+1, Steven D'Aprano wrote: Global *variables* are bad, not global functions. You have one global variable, the current window. So long as your API makes it obvious when the current window changes, implicitly operating on the current window is no

Re: Sudoku

2013-03-27 Thread Dave Angel
On 03/27/2013 01:44 AM, Eric Parry wrote: I downloaded the following program from somewhere It'd be good to show where you found it, and credit the apparent author. Bill Barksdale posted this in 2008 at:

Re: Separate Rows in reader

2013-03-27 Thread Jiewei Huang
On Tuesday, March 26, 2013 1:48:10 PM UTC+10, MRAB wrote: On 26/03/2013 03:33, Jiewei Huang wrote: On Tuesday, March 26, 2013 11:40:51 AM UTC+10, Dave Angel wrote: On 03/25/2013 09:05 PM, Jiewei Huang wrote: On Monday, March 25, 2013 11:51:51 PM UTC+10, rusi wrote: If you

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
any help here please? -- http://mail.python.org/mailman/listinfo/python-list

Re: Separate Rows in reader

2013-03-27 Thread rusi
On Mar 27, 2:35 pm, Jiewei Huang jiewe...@gmail.com wrote: On Tuesday, March 26, 2013 1:48:10 PM UTC+10, MRAB wrote: On 26/03/2013 03:33, Jiewei Huang wrote: On Tuesday, March 26, 2013 11:40:51 AM UTC+10, Dave Angel wrote: On 03/25/2013 09:05 PM, Jiewei Huang wrote: On Monday, March

What web server for WSGI? Recommended book?

2013-03-27 Thread Gilles
Hello After going through multiple articles about the advantage of using WSGI instead of FastCGI + Flup to run Python web apps, I have a couple of questions: 1. Which server + WSGI module would you recommend? I know about Apache and Graham Dumpleton's mod_wsgi, but what about Lighttpd

From Perl to Python: restructuring a HPC workflow

2013-03-27 Thread neurino
In the need for restructuring our daily workflow, i think it might be a good idea to ask the Python community and hopefully initiate a thread about pros and cons. We are a small group of people (approx. 10), working separetely on their own projects (each employee manages approx. 2-3

Re: Help me pick an API design (OO vs functional)

2013-03-27 Thread Chris Angelico
On Wed, Mar 27, 2013 at 7:55 PM, Michael Herrmann michael.herrm...@getautoma.com wrote: On Tuesday, March 26, 2013 5:41:42 PM UTC+1, Dave Angel wrote: To go back to my sample wrapper functions, they'd look something like (untested): def write(*args, focus=focused): focus.write(*args)

Re: Performance of int/long in Python 3

2013-03-27 Thread Mark Lawrence
On 27/03/2013 01:31, Ned Deily wrote: In article kitdqr$4m4$2...@ger.gmane.org, Mark Lawrence breamore...@yahoo.co.uk wrote: On 27/03/2013 00:00, Ned Deily wrote: [...] I repeat the friendly reminder I posted a few weeks ago and I'll be a little less oblique: please avoid gratuitous

Re: From Perl to Python: restructuring a HPC workflow

2013-03-27 Thread rusi
On Mar 27, 4:29 pm, neurino lelli.l...@googlemail.com wrote: In the need for restructuring our daily workflow, i think it might be a good idea to ask the Python community and hopefully initiate a thread about pros and cons. We are a small group of people (approx. 10), working separetely on

Re: From Perl to Python: restructuring a HPC workflow

2013-03-27 Thread Joel Goldstick
On Wed, Mar 27, 2013 at 7:51 AM, rusi rustompm...@gmail.com wrote: On Mar 27, 4:29 pm, neurino lelli.l...@googlemail.com wrote: In the need for restructuring our daily workflow, i think it might be a good idea to ask the Python community and hopefully initiate a thread about pros and cons.

Re: Help me pick an API design (OO vs functional)

2013-03-27 Thread Michael Herrmann
On Wednesday, March 27, 2013 12:44:49 PM UTC+1, Chris Angelico wrote: ... Not seeking to advocate this particular option, but it would be possible to make a single wrapper for all your functions to handle the focus= parameter: def focusable(func): @functools.wraps(func) def

Re: Splitting a list into even size chunks in python?

2013-03-27 Thread Roy Smith
In article mailman.3796.1364372856.2939.python-l...@python.org, Peter Otten __pete...@web.de wrote: Look again, for the grouper() recipe. Grouper() is good tty.cooked() with just a little time.time() and crypt.salt() -- http://mail.python.org/mailman/listinfo/python-list

Re: From Perl to Python: restructuring a HPC workflow

2013-03-27 Thread Chris Angelico
On Wed, Mar 27, 2013 at 10:29 PM, neurino lelli.l...@googlemail.com wrote: We are a small group of people (approx. 10), working separetely on their own projects (each employee manages approx. 2-3 projects). We deal with high loads of data everyday. This workflow has been flawless now for at

Re: Splitting a list into even size chunks in python?

2013-03-27 Thread Chris Angelico
On Wed, Mar 27, 2013 at 11:51 PM, Roy Smith r...@panix.com wrote: In article mailman.3796.1364372856.2939.python-l...@python.org, Peter Otten __pete...@web.de wrote: Look again, for the grouper() recipe. Grouper() is good tty.cooked() with just a little time.time() and crypt.salt() Huh,

Re: Help me pick an API design (OO vs functional)

2013-03-27 Thread Mitya Sirenef
On 03/27/2013 05:10 AM, Michael Herrmann wrote: At the very least, for small dialogs it's sipmpler to do: with press(CTRL + 's'): write(test.txt, into=File name) click(Save) I think what the context manager approach really has going for itself is the syntactic structure it

Re: Performance of int/long in Python 3

2013-03-27 Thread Dave Angel
On 03/26/2013 07:10 PM, Gregory Ewing wrote: On Wed, Mar 27, 2013 at 8:08 AM, Grant Edwards invalid@invalid.invalid wrote: Does that allow us to determine wheter integers are idiots or not? No, it doesn't. I'm fairly confident that most of them are not... however, I have my eye on 42. He

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread MRAB
On 27/03/2013 06:42, Νίκος Γκρ33κ wrote: Τη Τετάρτη, 27 Μαρτίου 2013 6:26:06 π.μ. UTC+2, ο χρήστης ru...@yahoo.com έγραψε: If not, maybe you can try adding a print statement to your code that will print the value of 'page'. This will be easier to do if you can run you code interactively. If

Re: how do you make a loop run in reverse?

2013-03-27 Thread Dave Angel
On 03/26/2013 07:59 PM, rahulredd...@hotmail.com wrote: So i have a set of for loops that create this : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

Re: Help me pick an API design (OO vs functional)

2013-03-27 Thread Ethan Furman
On 03/27/2013 02:34 AM, Michael Herrmann wrote: After everybody's input, I think Design #2 or Design #4 would be the best fit for us: Design #2: notepad_1 = start(Notepad) notepad_2 = start(Notepad) switch_to(notepad_1) write(Hello World!)

Re: The usage of -m option of python

2013-03-27 Thread Tom P
On 03/18/2013 10:17 PM, Peng Yu wrote: Hi, I don't quite understand how -m option is used. And it is difficult to search for -m in google. Could anybody provide me with an example on how to use this option? Thanks! -m module-name Searches sys.path for the named module

Re: The usage of -m option of python

2013-03-27 Thread Terry Reedy
On 3/18/2013 11:03 PM, Terry Reedy wrote: On 3/18/2013 5:17 PM, Peng Yu wrote: Hi, I don't quite understand how -m option is used. And it is difficult to search for -m in google. Could anybody provide me with an example on how to use this option? python -m test at a command line runs the

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread nagia . retsina
Τη Τετάρτη, 27 Μαρτίου 2013 6:48:44 μ.μ. UTC+2, ο χρήστης MRAB έγραψε: On 27/03/2013 06:42, Νίκος Γκρ33κ wrote: Τη Τετάρτη, 27 Μαρτίου 2013 6:26:06 π.μ. UTC+2, ο χρήστης ru...@yahoo.com έγραψε: If not, maybe you can try adding a print statement to your code that will print the

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
= 187 print ( Query Error: , sys.exc_info()[1].excepinfo()[2]) excepinfo is probably mis-spelled---I have no idea what you intend.l Python3 raised exceptions in an except: clause giving the double exception message that I don't think you'd have seen in python2. Maybe the

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
I had encoding isseus as well! Now i tried your suggestion changing comma with '%' and now the error is more clear. [code] _mysql_exceptions.OperationalError: (1054, Unknown column 'index.html' in 'where clause') [/code] loook at http://superhost.gr please to see the whoel traceback --

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Joel Goldstick
On Wed, Mar 27, 2013 at 2:48 PM, Νίκος Γκρ33κ nikos.gr...@gmail.com wrote: I had encoding isseus as well! Now i tried your suggestion changing comma with '%' and now the error is more clear. [code] _mysql_exceptions.OperationalError: (1054, Unknown column 'index.html' in 'where clause')

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
Τη Τετάρτη, 27 Μαρτίου 2013 9:06:27 μ.μ. UTC+2, ο χρήστης Joel Goldstick έγραψε: You should print the sql statement to see what is being created.  Create the sql, and assign it to a variable name.  Print that.  Then execute the command. Ok Joe, i just tried the followinf as you suggested

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
Even better: try: sql = '''SELECT hits FROM counters WHERE url = %s''' % page print( sql ) cur.execute( sql ) data = cur.fetchone() except MySQLdb.ProgrammingError as e: print ( Query Error: , dir( sys.exc_info()[1] ) ) sql statement seems

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 5:48 AM, Νίκος Γκρ33κ nikos.gr...@gmail.com wrote: I had encoding isseus as well! Now i tried your suggestion changing comma with '%' and now the error is more clear. [code] _mysql_exceptions.OperationalError: (1054, Unknown column 'index.html' in 'where clause')

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
Τη Τετάρτη, 27 Μαρτίου 2013 9:28:35 μ.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: On Thu, Mar 28, 2013 at 3:48 AM, MRAB pyt...@mrabarnett.plus.com wrote: A brief look at the documentation tells me that MySQL uses '?' as the placeholder instead of '%s': cur.execute('''SELECT hits FROM

Decorator help

2013-03-27 Thread Joseph L. Casale
I have a class which sets up some class vars, then several methods that are passed in data and do work referencing the class vars. I want to decorate these methods, the decorator needs access to the class vars, so I thought about making the decorator its own class and allowing it to accept

Re: Splitting a list into even size chunks in python?

2013-03-27 Thread Arnaud Delobelle
On 27 March 2013 08:27, Peter Otten __pete...@web.de wrote: Look again, for the grouper() recipe. For lists you can also use slicing: items ['a', 'b', 'c', 'd', 'e', 'f', 'g'] n = 3 [items[start:start+n] for start in range(0, len(items), n)] [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']]

Altering 2 statements from Python 2.6 = 3.2

2013-03-27 Thread Νίκος Γκρ33κ
Hello folks, With what do i need to replace: --- print ( Query Error: , sys.exc_info()[1].excepinfo()[2] ) - and -- date = date.strftime('%A, %e %b %Y').decode('cp1253').encode('utf8') -- in Python3? because in 2.6 used to work but they dont in Pytho 3 thank

Re: Decorator help

2013-03-27 Thread Arnaud Delobelle
On 27 March 2013 19:49, Joseph L. Casale jcas...@activenetwerx.com wrote: I have a class which sets up some class vars, then several methods that are passed in data and do work referencing the class vars. I want to decorate these methods, the decorator needs access to the class vars, so I

Re: Decorator help

2013-03-27 Thread Jason Swails
On Wed, Mar 27, 2013 at 3:49 PM, Joseph L. Casale jcas...@activenetwerx.com wrote: I have a class which sets up some class vars, then several methods that are passed in data and do work referencing the class vars. I want to decorate these methods, the decorator needs access to the class

Re: Performance of int/long in Python 3

2013-03-27 Thread jmfauth
On 26 mar, 22:08, Grant Edwards inva...@invalid.invalid wrote: I think we all agree that jmf is a character. -- The characters are also intrisic characteristics of a group in the Group Theory. If you are not a mathematician, but eg a scientist in need of these characters, they are

RE: Decorator help

2013-03-27 Thread Joseph L. Casale
 So decorators will never take instance variables as arguments (nor should they, since no instance can possibly exist when they execute). Right, I never thought of it that way, my only use of them has been trivial, in non class scenarios so far. Bear in mind, a decorator should take a

Re: how do you make a loop run in reverse?

2013-03-27 Thread Arnaud Delobelle
On 26 March 2013 23:59, rahulredd...@hotmail.com wrote: So i have a set of for loops that create this : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

Re: Separate Rows in reader

2013-03-27 Thread Jiewei Huang
On Wednesday, March 27, 2013 9:18:28 PM UTC+10, rusi wrote: On Mar 27, 2:35 pm, Jiewei Huang jiewe...@gmail.com wrote: On Tuesday, March 26, 2013 1:48:10 PM UTC+10, MRAB wrote: On 26/03/2013 03:33, Jiewei Huang wrote: On Tuesday, March 26, 2013 11:40:51 AM UTC+10, Dave Angel

Re: Separate Rows in reader

2013-03-27 Thread Jiewei Huang
On Wednesday, March 27, 2013 9:18:28 PM UTC+10, rusi wrote: On Mar 27, 2:35 pm, Jiewei Huang jiewe...@gmail.com wrote: On Tuesday, March 26, 2013 1:48:10 PM UTC+10, MRAB wrote: On 26/03/2013 03:33, Jiewei Huang wrote: On Tuesday, March 26, 2013 11:40:51 AM UTC+10, Dave Angel

Re: Altering 2 statements from Python 2.6 = 3.2

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 7:18 AM, Νίκος Γκρ33κ nikos.gr...@gmail.com wrote: date = date.strftime('%A, %e %b %Y').decode('cp1253').encode('utf8') For a start, figure out what you're trying to do. I'm trying to get my head around this line and I'm not getting anywhere. Is 'date' an instance of

Re: Decorator help

2013-03-27 Thread Steven D'Aprano
On Wed, 27 Mar 2013 19:49:54 +, Joseph L. Casale wrote: I have a class which sets up some class vars, then several methods that are passed in data and do work referencing the class vars. When you say class vars, do you mean variables which hold classes? Like string vars are variables

Re: Splitting a list into even size chunks in python?

2013-03-27 Thread Roy Smith
In article mailman.3809.1364389191.2939.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Wed, Mar 27, 2013 at 11:51 PM, Roy Smith r...@panix.com wrote: In article mailman.3796.1364372856.2939.python-l...@python.org, Peter Otten __pete...@web.de wrote: Look again, for

Re: Splitting a list into even size chunks in python?

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 10:42 AM, Roy Smith r...@panix.com wrote: In article mailman.3809.1364389191.2939.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Wed, Mar 27, 2013 at 11:51 PM, Roy Smith r...@panix.com wrote: In article

Re: Help me pick an API design (OO vs functional)

2013-03-27 Thread Steven D'Aprano
On Wed, 27 Mar 2013 02:34:09 -0700, Michael Herrmann wrote: On Tuesday, March 26, 2013 11:37:23 PM UTC+1, Steven D'Aprano wrote: Global *variables* are bad, not global functions. You have one global variable, the current window. So long as your API makes it obvious when the current window

Re: Separate Rows in reader

2013-03-27 Thread rusi
On Mar 28, 3:26 am, Jiewei Huang jiewe...@gmail.com wrote: On Wednesday, March 27, 2013 9:18:28 PM UTC+10, rusi wrote: On Mar 27, 2:35 pm, Jiewei Huang jiewe...@gmail.com wrote: On Tuesday, March 26, 2013 1:48:10 PM UTC+10, MRAB wrote: On 26/03/2013 03:33, Jiewei Huang wrote: On

Re: Separate Rows in reader

2013-03-27 Thread Steven D'Aprano
On Wed, 27 Mar 2013 18:24:24 -0700, rusi wrote: On Mar 28, 3:26 am, Jiewei Huang jiewe...@gmail.com wrote: On Wednesday, March 27, 2013 9:18:28 PM UTC+10, rusi wrote: On Mar 27, 2:35 pm, Jiewei Huang jiewe...@gmail.com wrote: On Tuesday, March 26, 2013 1:48:10 PM UTC+10, MRAB wrote: On

Re: Performance of int/long in Python 3

2013-03-27 Thread Steven D'Aprano
On Wed, 27 Mar 2013 11:51:07 +, Mark Lawrence defending an unproductive post flaming a troll: He's not going to change so neither am I. He's a troll disrupting the newsgroup, therefore I'm going to be a troll disrupting the newsgroup too, so nyah!!! I also suggest you go and moan at

Re: Altering 2 statements from Python 2.6 = 3.2

2013-03-27 Thread Νίκος Γκρ33κ
Τη Πέμπτη, 28 Μαρτίου 2013 12:55:11 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: On Thu, Mar 28, 2013 at 7:18 AM, Νίκος Γκρ33κ nikos.gr...@gmail.com wrote: date = date.strftime('%A, %e %b %Y').decode('cp1253').encode('utf8') For a start, figure out what you're trying to do. I'm trying

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
Τη Πέμπτη, 28 Μαρτίου 2013 12:48:54 π.μ. UTC+2, ο χρήστης Dennis Lee Bieber έγραψε: On Wed, 27 Mar 2013 16:48:44 +, MRAB pyt...@mrabarnett.plus.com declaimed the following in gmane.comp.python.general: A brief look at the documentation tells me that MySQL uses '?' as the

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
The following works in python 3.2 [code] cur.execute( '''SELECT hits FROM counters WHERE url = ?''') , (page,) [/code] is there a difefrence between the above and the follwong which works in python 2.6 [code] cur.execute( '''SELECT hits FROM counters WHERE url = ?''' ,

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
I think i have figured this out: cur.execute( '''SELECT hits FROM counters WHERE url = %s''') , (page,) is a tuple of two objects. The first is the result of cur.execute( '''SELECT hits FROM counters WHERE url = %s''') and the second is (page,) cur.execute( '''SELECT hits FROM counters WHERE

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 1:19 PM, Νίκος Γκρ33κ nikos.gr...@gmail.com wrote: The following works in python 3.2 [code] cur.execute( '''SELECT hits FROM counters WHERE url = ?''') , (page,) [/code] This is an email list and newsgroup. You don't need tags like that. I don't know what you

Re: Altering 2 statements from Python 2.6 = 3.2

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 1:16 PM, Νίκος Γκρ33κ nikos.gr...@gmail.com wrote: Τη Πέμπτη, 28 Μαρτίου 2013 12:55:11 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: On Thu, Mar 28, 2013 at 7:18 AM, Νίκος Γκρ33κ nikos.gr...@gmail.com wrote: date = date.strftime('%A, %e %b

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 1:24 PM, Νίκος Γκρ33κ nikos.gr...@gmail.com wrote: I think i have figured this out: cur.execute( '''SELECT hits FROM counters WHERE url = %s''') , (page,) is a tuple of two objects. The first is the result of cur.execute( '''SELECT hits FROM counters WHERE url =

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
Thank you for verifying this, Also now http://superhost.gr seems to stuck in the following line which i try to open an acii file to slect a random line, please take a look. -- http://mail.python.org/mailman/listinfo/python-list

Re: Altering 2 statements from Python 2.6 = 3.2

2013-03-27 Thread Νίκος Γκρ33κ
Τη Πέμπτη, 28 Μαρτίου 2013 4:28:04 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: On Thu, Mar 28, 2013 at 1:16 PM, Νίκος Γκρ33κ nikos.gr...@gmail.com wrote: Τη Πέμπτη, 28 Μαρτίου 2013 12:55:11 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: On Thu, Mar 28, 2013 at 7:18 AM, Νίκος Γκρ33κ

Re: Decorator help

2013-03-27 Thread Jason Swails
On Wed, Mar 27, 2013 at 7:29 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: The one doesn't follow from the other. Writing decorators as classes is fairly unusual. Normally, they will be regular functions. If your decorator needs to store so much state that it needs to be a

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
Τη Πέμπτη, 28 Μαρτίου 2013 4:46:48 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: On Thu, Mar 28, 2013 at 1:36 PM, Νίκος Γκρ33κ nikos.gr...@gmail.com wrote: Thank you for verifying this, Also now http://superhost.gr seems to stuck in the following line which i try to open an acii

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 1:36 PM, Νίκος Γκρ33κ nikos.gr...@gmail.com wrote: Thank you for verifying this, Also now http://superhost.gr seems to stuck in the following line which i try to open an acii file to slect a random line, please take a look. Your quotes file isn't ASCII. Read the error

Re: Sudoku

2013-03-27 Thread Eric Parry
Thank you all for your help and suggestions. Eric -- http://mail.python.org/mailman/listinfo/python-list

Re: Sudoku

2013-03-27 Thread Eric Parry
On Wednesday, March 27, 2013 6:28:01 PM UTC+10:30, Ulrich Eckhardt wrote: Am 27.03.2013 06:44, schrieb Eric Parry: I downloaded the following program from somewhere using a link from Wikipedia and inserted the “most difficult Sudoku puzzle ever” string into it and ran it. It worked

flaming vs accuracy [was Re: Performance of int/long in Python 3]

2013-03-27 Thread Ethan Furman
On 03/27/2013 06:47 PM, Steven D'Aprano wrote: On Wed, 27 Mar 2013 11:51:07 +, Mark Lawrence defending an unproductive post flaming a troll: I wouldn't call it unproductive -- a half-dozen amusing posts followed because of Mark's initial post, and they were a great relief from the tedium

Re: flaming vs accuracy [was Re: Performance of int/long in Python 3]

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 2:18 PM, Ethan Furman et...@stoneleaf.us wrote: Has anybody else thought that [jmf's] last few responses are starting to sound bot'ish? Yes, I did wonder. It's like he and Dihedral have been trading accounts sometimes. Hey, Dihedral, I hear there's a discussion of

Re: flaming vs accuracy [was Re: Performance of int/long in Python 3]

2013-03-27 Thread rusi
On Mar 28, 8:18 am, Ethan Furman et...@stoneleaf.us wrote: So long as Mark doesn't start cussing and swearing I'm not going to get worked up about it.  I find jmf's posts for more aggravating. I support Ned's original gentle reminder -- Please be civil irrespective of surrounding nonsensical

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
this worked quote = random.choice( list( open( /home/nikos/www/data/private/quotes.txt, 'rb') ) ) and also this f = open( /home/nikos/www/ + page, 'rb' ) i dont know why python 3 needs 'rb' though. Now ima having problem with this: htmldata = htmldata % (quote, music) it says soemthign

Cannot run a single MySQLdb execute....

2013-03-27 Thread Νίκος Γκρ33κ
I'am about to go nuts with python 3.2.3 Do you see somehtign wrong with the following statement? cur.execute( '''SELECT hits FROM counters WHERE url = ?''', (page,) ) data = cur.fetchone() because as you can see by visiting my webpage at http://superhost.gr it produces an error and i dont have

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 2:54 PM, Νίκος Γκρ33κ nikos.gr...@gmail.com wrote: this worked quote = random.choice( list( open( /home/nikos/www/data/private/quotes.txt, 'rb') ) ) and also this f = open( /home/nikos/www/ + page, 'rb' ) i dont know why python 3 needs 'rb' though. Now ima

Re: Cannot run a single MySQLdb execute....

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 2:50 PM, Νίκος Γκρ33κ nikos.gr...@gmail.com wrote: I'am about to go nuts with python 3.2.3 Do you see somehtign wrong with the following statement? cur.execute( '''SELECT hits FROM counters WHERE url = ?''', (page,) ) data = cur.fetchone() because as you can see by

Re: Cannot run a single MySQLdb execute....

2013-03-27 Thread Νίκος Γκρ33κ
Τη Πέμπτη, 28 Μαρτίου 2013 6:00:17 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: What paramstyle are you using? Yes it is Chris, but i'am not sure what exactly are you asking me. Please if you cna pout it even simper for me, thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: Cannot run a single MySQLdb execute....

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 3:03 PM, Νίκος Γκρ33κ nikos.gr...@gmail.com wrote: Τη Πέμπτη, 28 Μαρτίου 2013 6:00:17 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: What paramstyle are you using? Yes it is Chris, but i'am not sure what exactly are you asking me. Please if you cna pout it even simper

Re: Cannot run a single MySQLdb execute....

2013-03-27 Thread Νίκος Γκρ33κ
If you mean if iam using '?' or this '%s' the latter used to work flawlessly with python 2.6 but it does not in pythin 3.2.3 both this command fail in python 3.x cur.execute( '''SELECT hits FROM counters WHERE url = ?''', (page,) ) cur.execute( '''SELECT hits FROM counters WHERE url = %s''',

Re: Cannot run a single MySQLdb execute....

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 3:08 PM, Νίκος Γκρ33κ nikos.gr...@gmail.com wrote: If you mean if iam using '?' or this '%s' the latter used to work flawlessly with python 2.6 but it does not in pythin 3.2.3 Print out the value of that attribute. ChrisA --

Re: Cannot run a single MySQLdb execute....

2013-03-27 Thread Νίκος Γκρ33κ
Τη Πέμπτη, 28 Μαρτίου 2013 6:08:28 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: As it says in that document, paramstyle is a top-level module attribute. Try printing it out. See what it says. Then match your code sql = '''SELECT hits FROM counters WHERE url = %s''' % page print( sql )

Re: Cannot run a single MySQLdb execute....

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 3:18 PM, Νίκος Γκρ33κ nikos.gr...@gmail.com wrote: Τη Πέμπτη, 28 Μαρτίου 2013 6:08:28 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: As it says in that document, paramstyle is a top-level module attribute. Try printing it out. See what it says. Then match your code

Re: Cannot run a single MySQLdb execute....

2013-03-27 Thread Νίκος Γκρ33κ
Τη Πέμπτη, 28 Μαρτίου 2013 6:26:48 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: On Thu, Mar 28, 2013 at 3:18 PM, Νίκος Γκρ33κ nikos.gr...@gmail.com wrote: Τη Πέμπτη, 28 Μαρτίου 2013 6:08:28 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: As it says in that document, paramstyle is a

Re: Cannot run a single MySQLdb execute....

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 3:30 PM, Νίκος Γκρ33κ nikos.gr...@gmail.com wrote: Τη Πέμπτη, 28 Μαρτίου 2013 6:26:48 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: On Thu, Mar 28, 2013 at 3:18 PM, Νίκος Γκρ33κ nikos.gr...@gmail.com wrote: Τη Πέμπτη, 28 Μαρτίου 2013 6:08:28 π.μ. UTC+2, ο χρήστης

Re: Sudoku

2013-03-27 Thread Dave Angel
On 03/27/2013 11:00 PM, Eric Parry wrote: On Wednesday, March 27, 2013 6:28:01 PM UTC+10:30, Ulrich Eckhardt wrote: SNIP the double-spaced garbage that GoogleGroups put in - see http://wiki.python.org/moin/GoogleGroupsPython Thank you for your explanation. I noticed that in this

Re: Cannot run a single MySQLdb execute....

2013-03-27 Thread Νίκος Γκρ33κ
Τη Πέμπτη, 28 Μαρτίου 2013 6:35:14 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: No. I said to print out the paramstyle attribute. If it's that late and you haven't slept, get some sleep, then reread this thread. You may be able to respond more intelligently. What is a paramstyle

Re: Decorator help

2013-03-27 Thread Steven D'Aprano
On Wed, 27 Mar 2013 22:38:11 -0400, Jason Swails wrote: The second case is the easiest. Suppose you have a class like this, with many methods which have code in common. Here's a toy example: def MyClass(object): x = class attribute def __init__(self, y): self.y = y In

Re: flaming vs accuracy [was Re: Performance of int/long in Python 3]

2013-03-27 Thread Steven D'Aprano
On Wed, 27 Mar 2013 20:49:20 -0700, rusi wrote: On Mar 28, 8:18 am, Ethan Furman et...@stoneleaf.us wrote: So long as Mark doesn't start cussing and swearing I'm not going to get worked up about it.  I find jmf's posts for more aggravating. I support Ned's original gentle reminder --

Re: flaming vs accuracy [was Re: Performance of int/long in Python 3]

2013-03-27 Thread rusi
On Mar 28, 10:20 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Wed, 27 Mar 2013 20:49:20 -0700, rusi wrote: On Mar 28, 8:18 am, Ethan Furman et...@stoneleaf.us wrote: So long as Mark doesn't start cussing and swearing I'm not going to get worked up about it.  I find

[issue17556] os.path.join() converts None to '' by default

2013-03-27 Thread Muhammad Hallaj Subery
New submission from Muhammad Hallaj Subery: I think the default behavior of os.path.join() when None is passed as the first argument should be to translate it to '' by default. import os os.path.join(None, 'somewhere') 'somewhere' vs the current import os os.path.join(None, 'somewhere')

[issue17556] os.path.join() converts None to '' by default

2013-03-27 Thread Muhammad Hallaj Subery
Muhammad Hallaj Subery added the comment: I believe this can be easily archived by adding the following changes: 64c64 path = a or '' --- -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17556

  1   2   3   >