How to suppress exception printing to console?

2012-05-31 Thread Qi
Hi guys, I have an application that embedding Python into C++. When any exception occurred in C++ code, PyErr_SetString will be called to propagate the exception to Python. The problem is, some unit tests trigger exception on intention. So it's OK to have the exceptions. But Python will still pr

Re: How to suppress exception printing to console?

2012-05-31 Thread Gelonida N
On 05/31/2012 09:57 AM, Qi wrote: Hi guys, I have an application that embedding Python into C++. When any exception occurred in C++ code, PyErr_SetString will be called to propagate the exception to Python. The problem is, some unit tests trigger exception on intention. So it's OK to have the e

colorbar of image

2012-05-31 Thread Mireille . Hagbe . Ngom
that is my script from matplotlib import pyplot img = pyplot.imread('image.png') pyplot.imshow(img) pyplot.show() the problem is i want to display either colorbar associated to the image and image or just colorbar associated to the image when i download image.png.how can i do? tk's mirei

Re: Maintaining Multiple Copies of Python (Linux)

2012-05-31 Thread Oscar Benjamin
On 31 May 2012 02:41, Nicholas Fitzkee wrote: > On Wednesday, May 30, 2012 7:55:33 PM UTC-5, Ben Finney wrote: > > > The consensus solution for this is ‘virtualenv’ > > http://pypi.python.org/pypi/virtualenv>. > > > > It is so popular as a solution for the kinds of problems you describe > > that

Re: Object cleanup

2012-05-31 Thread psaff...@googlemail.com
Thanks for all the responses. It looks like none of the BeautifulSoup objects have __del__ methods, so I don't think that can be the problem. To answer your other question, guppy was the best match I came up with when looking for a memory profile for Python (or more specifically "Heapy"): http

Templating library which generates HTML+JS for interfacing RESTfully?

2012-05-31 Thread Alec Taylor
Are there any templating libraries—e.g.: Jinja2, Django Template Engine, Mako &etc—which can be used to interface over REST, XMLRPC xor JSONRPC? My use-cases follow: 1. Generate a website, e.g.: to run from example.com (currently every templating language does this out of the box) 2. Generate th

Re: Object cleanup

2012-05-31 Thread Oscar Benjamin
On 31 May 2012 11:57, psaff...@googlemail.com wrote: > Thanks for all the responses. > > It looks like none of the BeautifulSoup objects have __del__ methods, so I > don't think that can be the problem. > > To answer your other question, guppy was the best match I came up with > when looking for a

Re: Tkinter deadlock on graceful exit

2012-05-31 Thread Matteo Landi
On Thu, May 31, 2012 at 3:42 AM, Terry Reedy wrote: > On 5/30/2012 6:19 PM, Matteo Landi wrote: >> >> On May/28, Matteo Landi wrote: >>> >>> Hi list, >>> recently I started to work on an application [1] which makes use of the >>> Tkinter >>> module to handle interaction with the user.  Simply put,

Re: How to suppress exception printing to console?

2012-05-31 Thread Steven D'Aprano
On Thu, 31 May 2012 15:57:08 +0800, Qi wrote: > Hi guys, > > I have an application that embedding Python into C++. When any exception > occurred in C++ code, PyErr_SetString will be called to propagate the > exception to Python. > > The problem is, some unit tests trigger exception on intention.

Re: How to suppress exception printing to console?

2012-05-31 Thread Qi
On 2012-5-31 21:31, Steven D'Aprano wrote: The problem is, some unit tests trigger exception on intention. I'm sorry, I don't understand what you mean by "on intention". I mean the exception is expected. The test will only pass if the embedded Python code raise certain exception. Are you us

Re: How to suppress exception printing to console?

2012-05-31 Thread Ulrich Eckhardt
Am 31.05.2012 09:57, schrieb Qi: > I have an application that embedding Python into C++. > When any exception occurred in C++ code, PyErr_SetString will > be called to propagate the exception to Python. The first sentence is clear. The second sentence rather sounds as if you were implementing a Py

Re: sqlite INSERT performance

2012-05-31 Thread duncan smith
On 31/05/12 06:15, John Nagle wrote: On 5/30/2012 6:57 PM, duncan smith wrote: Hello, I have been attempting to speed up some code by using an sqlite database, but I'm not getting the performance gains I expected. SQLite is a "lite" database. It's good for data that's read a lot and not change

Re: sqlite INSERT performance

2012-05-31 Thread Jon Clements
On Thursday, 31 May 2012 16:25:10 UTC+1, duncan smith wrote: > On 31/05/12 06:15, John Nagle wrote: > > On 5/30/2012 6:57 PM, duncan smith wrote: > >> Hello, > >> I have been attempting to speed up some code by using an sqlite > >> database, but I'm not getting the performance gains I expected. >

colorbar of image

2012-05-31 Thread mhagbeng
that is my script from matplotlib import pyplot img = pyplot.imread('image.png') pyplot.imshow(img) pyplot.show() the problem is i want to display either colorbar associated to the image and image or just colorbar associated to the image when i download image.png.how can i do? tk's mireill

reading txt file

2012-05-31 Thread Ahmed, Shakir
HI: I am trying to read a txt file and dump the columns in an access database table. But getting problem: >>> Unhandled exception while debugging... Traceback (most recent call last): File "C:\WindDuration\Reading_test.py", line 14, in my_length_1 = nmAddrList[1] IndexError: list index out

Re: reading txt file

2012-05-31 Thread MRAB
On 31/05/2012 16:02, Ahmed, Shakir wrote: HI: I am trying to read a txt file and dump the columns in an access database table. But getting problem: Unhandled exception while debugging... Traceback (most recent call last): File "C:\WindDuration\Reading_test.py", line 14, in my_length_

Re: sqlite INSERT performance

2012-05-31 Thread duncan smith
On 31/05/12 17:06, Jon Clements wrote: On Thursday, 31 May 2012 16:25:10 UTC+1, duncan smith wrote: On 31/05/12 06:15, John Nagle wrote: On 5/30/2012 6:57 PM, duncan smith wrote: Hello, I have been attempting to speed up some code by using an sqlite database, but I'm not getting the performan

Re: reading txt file

2012-05-31 Thread Terry Reedy
On 5/31/2012 11:02 AM, Ahmed, Shakir wrote: When you want to start a new thread, make sure you start a new thread and do not post as a response to another thread. This will get lost as a response to 'How to suppress ...'. Is this a homework, hobby, or work exercise? I am trying to read a tx

Re: cmd2, an extenstion of cmd that parses its argument list

2012-05-31 Thread Adam Tauno Williams
On Thu, 2012-04-26 at 12:16 -0700, anntzer@gmail.com wrote: > On Sunday, March 18, 2012 10:12:24 PM UTC-7, anntz...@gmail.com wrote: > > Dear all, > > I would like to announce the first public release of cmd2, an extension of > > the standard library's cmd with argument parsing, here: > > ht

Re: cmd2, an extenstion of cmd that parses its argument list

2012-05-31 Thread Adam Tauno Williams
On Thu, 2012-05-31 at 15:21 -0400, Adam Tauno Williams wrote: > On Thu, 2012-04-26 at 12:16 -0700, anntzer@gmail.com wrote: > > On Sunday, March 18, 2012 10:12:24 PM UTC-7, anntz...@gmail.com wrote: > > > Dear all, > > > I would like to announce the first public release of cmd2, an extension

Re: cmd2, an extenstion of cmd that parses its argument list

2012-05-31 Thread Antony Lee
I am already using shlex.split() (this is a customizable hook). On Thu, May 31, 2012 at 03:42:19PM -0400, Adam Tauno Williams wrote: > On Thu, 2012-05-31 at 15:21 -0400, Adam Tauno Williams wrote: > > On Thu, 2012-04-26 at 12:16 -0700, anntzer@gmail.com wrote: > > > On Sunday, March 18, 2012

Re: python3 raw strings and \u escapes

2012-05-31 Thread ru...@yahoo.com
On 05/30/2012 09:07 AM, ru...@yahoo.com wrote: > On 05/30/2012 05:54 AM, Thomas Rachel wrote: >> Am 30.05.2012 08:52 schrieb ru...@yahoo.com: >> >>> This breaks a lot of my code because in python 2 >>>re.split (ur'[\u3000]', u'A\u3000A') ==> [u'A', u'A'] >>> but in python 3 (the result of

[RELEASED] Python 3.3.0 alpha 4

2012-05-31 Thread Georg Brandl
On behalf of the Python development team, I'm happy to announce the fourth alpha release of Python 3.3.0. This is a preview release, and its use is not recommended in production settings. Python 3.3 includes a range of improvements of the 3.x series, as well as easier porting between 2.x and 3.x.

Re: python3 raw strings and \u escapes

2012-05-31 Thread Chris Angelico
On Fri, Jun 1, 2012 at 6:28 AM, ru...@yahoo.com wrote: > ... a lexer module that is structured as many > dozens of little functions, each with a docstring that is > a regex string. This may be a good opportunity to take a step back and ask yourself: Why so many functions, each with a regular expr

Re: python3 raw strings and \u escapes

2012-05-31 Thread ru...@yahoo.com
On 05/31/2012 03:10 PM, Chris Angelico wrote: > On Fri, Jun 1, 2012 at 6:28 AM, ru...@yahoo.com wrote: >> ... a lexer module that is structured as many >> dozens of little functions, each with a docstring that is >> a regex string. > > This may be a good opportunity to take a step back and ask you

Re: How to suppress exception printing to console?

2012-05-31 Thread Steven W. Orr
On 5/31/2012 3:57 AM, Qi wrote: I have an application that embedding Python into C++. When any exception occurred in C++ code, PyErr_SetString will be called to propagate the exception to Python. The problem is, some unit tests trigger exception on intention. So it's OK to have the exceptions.

Re: How to suppress exception printing to console?

2012-05-31 Thread Qi
On 2012-5-31 23:01, Ulrich Eckhardt wrote: Am 31.05.2012 09:57, schrieb Qi: The first sentence is clear. The second sentence rather sounds as if you were implementing a Python module in C++. This is the opposite to embedding Python in C++, it's rather embedding C++ in Python. Or is it a C++ funct