Re: [Python-Dev] Building thread-safe sqlite3 with Python 2.6.5rc1

2010-03-08 Thread Oleg Broytman
On Mon, Mar 08, 2010 at 05:28:10PM -0500, Darren Govoni wrote: > ProgrammingError: SQLite objects created in a thread can only be used in > that same thread.The object was created in thread id -1217128768 and > this is thread id -1218753680 Darren, try to pass check_same_thread=False when creat

Re: [Python-Dev] Building thread-safe sqlite3 with Python 2.6.5rc1

2010-03-08 Thread Martin v. Löwis
> Which is correct. Yet when I run my progam using the newly built python > executable and attempt to use sqlite3 > functionality across threads it still says: > > ProgrammingError: SQLite objects created in a thread can only be used in > that same thread.The object was created in thread id -12171

Re: [Python-Dev] Building thread-safe sqlite3 with Python 2.6.5rc1

2010-03-08 Thread Darren Govoni
Thanks. It says. sqlite: found /usr/local/include/sqlite3.h /usr/local/include/sqlite3.h: version 3.6.22 Which is correct. Yet when I run my progam using the newly built python executable and attempt to use sqlite3 functionality across threads it still says: ProgrammingError: SQLite objects crea

Re: [Python-Dev] Catch SIGINT at Python startup

2010-03-08 Thread Guido van Rossum
On Mon, Mar 8, 2010 at 2:01 PM, Victor Stinner wrote: > Le lundi 08 mars 2010 22:06:36, vous avez écrit : >> OTOH I think the try/except in site.py around the execution of >> sitecustomize.py might be changed so that it prints a full traceback >> whenever it raises an exception other than ImportEr

Re: [Python-Dev] Catch SIGINT at Python startup

2010-03-08 Thread Victor Stinner
Le lundi 08 mars 2010 22:06:36, vous avez écrit : > OTOH I think the try/except in site.py around the execution of > sitecustomize.py might be changed so that it prints a full traceback > whenever it raises an exception other than ImportError or, again, > exceptions inheriting from BaseException bu

Re: [Python-Dev] argparse ugliness

2010-03-08 Thread Ben Finney
David Stanek writes: > On Mon, Mar 8, 2010 at 10:40 AM, Steven Bethard > wrote: > >  parser.add_argument ('--plot', action='store_true') […] +1. > Any reason not to do something like: > > from argparse import actions > ... > parser.add_argument('--plot', actions.store_true) > > Basically

Re: [Python-Dev] [PEP 3148] futures - execute computations asynchronously

2010-03-08 Thread Greg Ewing
Dj Gilcrease wrote: executor = executors.create(NAME, *args, **kwargs) # NAME is 'process' or 'thread' by default from concurrent.futures import executors, ExecutorBase class MyExecutor(ExecutorBase): ... executors.register(NAME, MyExecutor) I don't understand the reason for using a registrat

Re: [Python-Dev] Building thread-safe sqlite3 with Python 2.6.5rc1

2010-03-08 Thread Martin v. Löwis
> thanks for any tips. Set sqlite_setup_debug to True in setup.py Regards, Martin ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archiv

Re: [Python-Dev] Catch SIGINT at Python startup

2010-03-08 Thread Victor Stinner
Le lundi 08 mars 2010 22:18:34, Glyph Lefkowitz a écrit : > On Mar 8, 2010, at 4:06 PM, Guido van Rossum wrote: > > I am trying to remember why I made site.py failures non-fatal in the > > first place. I don't have any specific recollection but it must've > > been either from before the separation

Re: [Python-Dev] Catch SIGINT at Python startup

2010-03-08 Thread Guido van Rossum
On Mon, Mar 8, 2010 at 1:18 PM, Glyph Lefkowitz wrote: > > On Mar 8, 2010, at 4:06 PM, Guido van Rossum wrote: > > I am trying to remember why I made site.py failures non-fatal in the > first place. I don't have any specific recollection but it must've > been either from before the separation betw

Re: [Python-Dev] argparse ugliness

2010-03-08 Thread Greg Ewing
Xavier Morel wrote: So you'd have to write add_argument('--plot', action=actions.store_true) which is straight from the department of redundant redundancies. This could easily be fixed with from argparse.actions import store_true An option would be parser.add(actions.StoreTrue('--plot'

Re: [Python-Dev] argparse ugliness

2010-03-08 Thread Robert Kern
On 2010-03-08 15:20 PM, Greg Ewing wrote: Mark Russell wrote: Boolean flags are a common enough case that I'd be inclined to add a wrapper method, parser.add_bool_argument('--plot') +1, this looks good. I've added it to the argparse bugtracker, along with my suggested spelling add_flag():

Re: [Python-Dev] [PEP 3148] futures - execute computations asynchronously

2010-03-08 Thread Greg Ewing
Terry Reedy wrote: Looking more close, I gather that the prime results will be printed 'in order' (waiting on each even if others are done) while the url results will be printed 'as available'. Seems to me that if you care about the order of the results, you should be able to just wait for eac

Re: [Python-Dev] argparse ugliness

2010-03-08 Thread Greg Ewing
Steven Bethard wrote: Because the names are so long and you'd have to import them, I've left them as private attributes of the module, but if there's really demand, we could rename them to argparse.StoreTrueAction, etc. What's wrong with just StoreTrue? -- Greg ___

Re: [Python-Dev] Catch SIGINT at Python startup

2010-03-08 Thread Glyph Lefkowitz
On Mar 8, 2010, at 4:06 PM, Guido van Rossum wrote: > I am trying to remember why I made site.py failures non-fatal in the > first place. I don't have any specific recollection but it must've > been either from before the separation between site.py (part of the > stdlib) and sitecustomize.py (sit

Re: [Python-Dev] [PEP 3148] futures - execute computations asynchronously

2010-03-08 Thread exarkun
On 08:56 pm, digitalx...@gmail.com wrote: On Mon, Mar 8, 2010 at 12:04 PM, Dj Gilcrease wrote: A style I have used in my own code in the past is a Singleton class with register and create methods, where the register takes a name(string) and the class and the create method takes the name and *ar

Re: [Python-Dev] argparse ugliness

2010-03-08 Thread Greg Ewing
Mark Russell wrote: Boolean flags are a common enough case that I'd be inclined to add a wrapper method, parser.add_bool_argument('--plot') +1, this looks good. -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.or

Re: [Python-Dev] Catch SIGINT at Python startup

2010-03-08 Thread Guido van Rossum
On Mon, Mar 8, 2010 at 12:50 PM, Victor Stinner wrote: > Le lundi 08 mars 2010 18:47:18, Guido van Rossum a écrit : >> Actually it sounds like there's some overly general except clause >> somewhere that should be adjusted to catch just "Exception" instead of >> "*". > > Most of my patches (for SIG

Re: [Python-Dev] [PEP 3148] futures - execute computations asynchronously

2010-03-08 Thread Dj Gilcrease
On Mon, Mar 8, 2010 at 12:04 PM, Dj Gilcrease wrote: > A style I have used in my own code in the past is a Singleton class > with register and create methods, where the register takes a > name(string) and the class and the create method takes the name and > *args, **kwargs and acts as a factory.

Re: [Python-Dev] [PEP 3148] futures - execute computations asynchronously

2010-03-08 Thread skip
>> I'm +1 on adding a nice task queuing system, -1 on calling it by any >> other name. ;-) Nick> As Guido said, let's call the nice task queuing system "futures" Nick> and point people wanting a full-power asynchronous process model Nick> to Twisted Can this module at least

Re: [Python-Dev] Catch SIGINT at Python startup

2010-03-08 Thread Victor Stinner
Hi, Le lundi 08 mars 2010 18:47:18, Guido van Rossum a écrit : > Actually it sounds like there's some overly general except clause > somewhere that should be adjusted to catch just "Exception" instead of > "*". Most of my patches (for SIGINT) are exactly doing that: check the exception type inst

[Python-Dev] Building thread-safe sqlite3 with Python 2.6.5rc1

2010-03-08 Thread Darren Govoni
Hi, I'm trying to get the thread-safe enabled for sqlite3 in my build of 2.6.5rc1, but its not taking and throws the old thread access error. I am running Ubuntu with other versions of Python, but I successfully built and installed sqlite 3.6.22, pysqlite 2.6.0. Do I have to set something explici

Re: [Python-Dev] unittest2 plus class and module level fixtures in unittest

2010-03-08 Thread Michael Foord
On 08/03/2010 01:11, Antoine Pitrou wrote: Le Mon, 08 Mar 2010 00:51:02 +, Michael Foord a écrit : In other news, class and module fixtures (setUpClass / tearDownClass / setUpModule / tearDownModule) are now implemented in unittest (in trunk - not yet merged to py3k). These features are

Re: [Python-Dev] [PEP 3148] futures - execute computations asynchronously

2010-03-08 Thread Dj Gilcrease
On Mon, Mar 8, 2010 at 4:25 AM, Nick Coghlan wrote: > Wouldn't a factory function serve that purpose just as well? Or even > just "from concurrent.futures import ProcessPoolExecutor as TaskExecutor". > > That last form has the virtue that you can retrieve your executor from > anywhere rather than

Re: [Python-Dev] Catch SIGINT at Python startup

2010-03-08 Thread Guido van Rossum
On Mon, Mar 8, 2010 at 10:21 AM, Maciej Fijalkowski wrote: > On Mon, Mar 8, 2010 at 10:47 AM, Guido van Rossum wrote: >> Actually it sounds like there's some overly general except clause >> somewhere that should be adjusted to catch just "Exception" instead of >> "*". >> > > There is at least one

Re: [Python-Dev] Catch SIGINT at Python startup

2010-03-08 Thread Maciej Fijalkowski
On Mon, Mar 8, 2010 at 10:47 AM, Guido van Rossum wrote: > Actually it sounds like there's some overly general except clause > somewhere that should be adjusted to catch just "Exception" instead of > "*". > There is at least one that prints "import 'site' failed" and continues to run your program

Re: [Python-Dev] argparse ugliness

2010-03-08 Thread Guido van Rossum
On Mon, Mar 8, 2010 at 9:17 AM, Ron Adam wrote: > I like the strings.  They are simple and easy to use/read and they don't > have to be created or imported before the parser is defined. I like them too. I don't see anything unpythonic about them. > That allows me > to put the parser setup right

Re: [Python-Dev] Catch SIGINT at Python startup

2010-03-08 Thread Guido van Rossum
Actually it sounds like there's some overly general except clause somewhere that should be adjusted to catch just "Exception" instead of "*". On Mon, Mar 8, 2010 at 9:14 AM, Michael Foord wrote: > On 08/03/2010 13:12, Victor Stinner wrote: >> >> Hi, >> >> I wrote patches for the issue #3137 and I

Re: [Python-Dev] argparse ugliness

2010-03-08 Thread Ron Adam
Steven Bethard wrote: On Mon, Mar 8, 2010 at 7:40 AM, Steven Bethard wrote: On Sun, Mar 7, 2010 at 11:49 AM, Guido van Rossum wrote: On Sun, Mar 7, 2010 at 4:29 AM, Neal Becker wrote: Brian Curtin wrote: On Fri, Mar 5, 2010 at 12:51, Neal Becker wrote: I generally enjoy argparse, but

Re: [Python-Dev] Catch SIGINT at Python startup

2010-03-08 Thread Michael Foord
On 08/03/2010 13:12, Victor Stinner wrote: Hi, I wrote patches for the issue #3137 and I would like your opinion about my solution (not directly about the patches): I propose to consider a SIGINT during startup as a fatal error. If you press CTRL+c while Python is starting, Python displays an er

Re: [Python-Dev] argparse ugliness

2010-03-08 Thread David Stanek
On Mon, Mar 8, 2010 at 11:49 AM, Xavier Morel wrote: > On 8 Mar 2010, at 16:53 , David Stanek wrote: >> >> On Mon, Mar 8, 2010 at 10:40 AM, Steven Bethard >> wrote: >>> >>> In argparse, unlike optparse, actions are actually defined by objects >>> with a particular API, and the string is just a sh

Re: [Python-Dev] argparse ugliness

2010-03-08 Thread Xavier Morel
On 8 Mar 2010, at 16:53 , David Stanek wrote: > > On Mon, Mar 8, 2010 at 10:40 AM, Steven Bethard > wrote: >> >> In argparse, unlike optparse, actions are actually defined by objects >> with a particular API, and the string is just a shorthand for >> referring to that. So: >> >> parser.add_arg

Re: [Python-Dev] argparse ugliness

2010-03-08 Thread Neal Becker
On Monday 08 March 2010, David Stanek wrote: > On Mon, Mar 8, 2010 at 10:40 AM, Steven Bethard > > wrote: > > In argparse, unlike optparse, actions are actually defined by objects > > with a particular API, and the string is just a shorthand for > > referring to that. So: > > > > parser.add_arg

Re: [Python-Dev] [PEP 3148] futures - execute computations asynchronously

2010-03-08 Thread Terry Reedy
On 3/6/2010 4:20 AM, Brian Quinlan wrote: On 6 Mar 2010, at 03:21, Daniel Stutzbach wrote: On Fri, Mar 5, 2010 at 12:03 AM, Brian Quinlan mailto:br...@sweetapp.com>> wrote: import futures +1 on the idea, -1 on the name. It's too similar to "from __future__ import ...". Also, the PEP sh

Re: [Python-Dev] [PEP 3148] futures - execute computations asynchronously

2010-03-08 Thread Terry Reedy
On 3/8/2010 6:14 AM, Nick Coghlan wrote: P.J. Eby wrote: I'm +1 on adding a nice task queuing system, -1 on calling it by any other name. ;-) As Guido said, let's call the nice task queuing system "futures" and I was confused by 'futures' also until Philip explained it as task-queue or tas

Re: [Python-Dev] argparse ugliness

2010-03-08 Thread David Stanek
On Mon, Mar 8, 2010 at 10:40 AM, Steven Bethard wrote: > > In argparse, unlike optparse, actions are actually defined by objects > with a particular API, and the string is just a shorthand for > referring to that. So: > >  parser.add_argument ('--plot', action='store_true') > > is equivalent to: >

Re: [Python-Dev] argparse ugliness

2010-03-08 Thread Steven Bethard
On Mon, Mar 8, 2010 at 7:40 AM, Steven Bethard wrote: > On Sun, Mar 7, 2010 at 11:49 AM, Guido van Rossum wrote: >> On Sun, Mar 7, 2010 at 4:29 AM, Neal Becker wrote: >>> Brian Curtin wrote: >>> On Fri, Mar 5, 2010 at 12:51, Neal Becker wrote: > I generally enjoy argparse, but one

Re: [Python-Dev] argparse ugliness

2010-03-08 Thread Steven Bethard
On Sun, Mar 7, 2010 at 11:49 AM, Guido van Rossum wrote: > On Sun, Mar 7, 2010 at 4:29 AM, Neal Becker wrote: >> Brian Curtin wrote: >> >>> On Fri, Mar 5, 2010 at 12:51, Neal Becker wrote: >>> I generally enjoy argparse, but one thing I find rather ugly and unpythonic.    par

[Python-Dev] Catch SIGINT at Python startup

2010-03-08 Thread Victor Stinner
Hi, I wrote patches for the issue #3137 and I would like your opinion about my solution (not directly about the patches): I propose to consider a SIGINT during startup as a fatal error. If you press CTRL+c while Python is starting, Python displays an error and exit with the code 1. Currently,

Re: [Python-Dev] [PEP 3148] futures - execute computations asynchronously

2010-03-08 Thread Nick Coghlan
Dj Gilcrease wrote: > On Sun, Mar 7, 2010 at 6:50 AM, Jesse Noller wrote: >> Making the tests and examples happy on windows is fine; but some >> explanation is needed for the API changes. >> > > My primary motivation behind the API change is so there is just a > single public Executor class that

Re: [Python-Dev] [PEP 3148] futures - execute computations asynchronously

2010-03-08 Thread Nick Coghlan
P.J. Eby wrote: > I'm +1 on adding a nice task queuing system, -1 on calling it by any > other name. ;-) As Guido said, let's call the nice task queuing system "futures" and point people wanting a full-power asynchronous process model to Twisted - while the Deferred API may technically be indepen

Re: [Python-Dev] argparse ugliness

2010-03-08 Thread Mark Russell
On 7 Mar 2010, at 19:49, Guido van Rossum wrote: > How would you write the example instead then? Boolean flags are a common enough case that I'd be inclined to add a wrapper method, so you could just say: parser.add_bool_argument('--plot') As you can always fall back to the more general