Re: [BangPypers] suppressing the exception stack trace

2009-09-16 Thread steve

On 09/16/2009 11:39 AM, Vishal wrote:



On Tue, Sep 15, 2009 at 9:07 PM, steve mailto:st...@lonetwin.net>> wrote:

On 09/15/2009 08:56 PM, Vishal wrote:

Hello,

I would like to raise an exception of type Exception(), however the
regular exception stack trace needs to be supressed.

This is needed in a function that takes raw_input() from the
user and
based on 'Y' or 'N', the function suspends further execution and
returns
to the python prompt or Hicontinues. An exit() brings it out of
the python
processwhere as what is needed is coming back to the python
prompt.

I want a custom message to appear instead of a regular exception
stack
trace message.

How to do this? any pointers...?

Python 2.6 (r26:66714, Jun  8 2009, 16:07:29)
[GCC 4.4.0 20090506 (Red Hat 4.4.0-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
> >> import traceback
> >> try:
... 1 + "foo"
... except Exception, e:
... traceback.format_stack(limit=1)
...
['  File "", line 4, in \n']
> >> help(traceback)


HTH,
- steve



Forgot to mention that we are currently stuck with python2.5.2

As part of a debug/test hook, I would like to suspend further action of
a program, after a certain point in the procedure. What I had come up
with is a function named testHook() which does this:

def testHook():
"""
"""
 choice = raw_input("Would you like to continue (Y or N): ")
 try:
 if(str(choice).lower() != 'y'):
 print("You chose not to go ahead. Ok!!\nAborting Now...")
 raise Exception("User initiated Abort...")
 except Exception:
 raise # re-raise it..so we come out of execution loop

In this case, a stack trace gets printed out, before the string 'user
initiated abort' comes up. I want to remove that stack trace...so it
looks more clean to a user.

What can be done in this case?


Well, I don't understand how and from what context you are calling testHook(). 
My first instinct is to ask, why you can't simply return instead of 'raise' on 
an abort ? like so ...


def testHook(exc):
choice = raw_input("Would you like to continue (Y or N): ")
if(str(choice).lower() != 'y'):
print("You chose not to go ahead. Ok!!\nAborting Now...")
print "User initiated Abort..."
return -1 # ...or any other value that makes sense to your app.
else:
raise exc # re-raise the passed exception

In which case, I am assuming testHook() called like this:
try:
1 + "foo"
except Exception, e:
return testHook(e)


or any other way of creating such a hook?

Yes. The way I would do this sort of this is by using decorators:

>>> def testHook(func):
... def wrap_exception(*args):
... try:
... func(*args)
... except Exception, e:
... choice = raw_input("Would you like to continue (Y or N): 
")
... if (str(choice).lower() != 'y'):
... print("You chose not to go ahead. Ok!!\nAborting 
Now...")

... print "User initiated abort ..."
... print "on recieving %s" % e.message
... return
... else:
... print "redirect to debugger in this block ..."
... return wrap_exception
...
>>> @testHook
... def main(a, b):
... return a + b
...
>>> main(1, "foo")
Would you like to continue (Y or N): n
You chose not to go ahead. Ok!!
Aborting Now...
User initiated abort ...
on recieving unsupported operand type(s) for +: 'int' and 'str'
>>>


Here is a good article for introducing decorators:
http://www.ibm.com/developerworks/linux/library/l-cpdecor.html

HTH,
cheers,
- steve
--
random non tech spiel: http://lonetwin.blogspot.com/
tech randomness: http://lonehacks.blogspot.com/
what i'm stumbling into: http://lonetwin.stumbleupon.com/
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


[BangPypers] Fwd: Join Us for Mozilla Service Week

2009-09-16 Thread Shivaraj M S
-- Forwarded message --
From: SourceForge.net Team 
Date: Wed, Sep 16, 2009 at 6:20 AM
Subject: Join Us for Mozilla Service Week
To: shivraj...@gmail.com


Helping others - it comes naturally to people who write open source
software. Now the Mozilla Foundation is trying to employ the power of the
community in a more direct and hands-on way during Mozilla Service Week
(http://mozillaservice.org/learn_more/volunteer/en_US).

During this week, Mozilla (and SourceForge) encourage you to volunteer in
your community. Tech savvy folks can apply their skills in a variety of
ways. Some ideas from the foundation:

. Teach senior citizens how to use the Web.
. Show a non-profit how to use social networking to grow its base of
supporters.
. Help install a wireless network at a school.
. Create Web how-to materials for a library's computer cluster.
. Refurbish hardware for a local computer center.
. Update a non-profit organization's web site.

Organizations and projects that need assistance can also register to get
help.

As a company and as individuals, we at SourceForge will be participating in
Mozilla Service Week. We encourage you to get out there in your own
community and make a difference!



--
This message was sent on behalf of SourceForge.net.

To unsubscribe from future mailings, login to the SourceForge.net site
and modify your subscription preferences at:
https://sourceforge.net/account/

Or contact us by postal mail at:
Attn:  SourceForge.net Legal Services - Unsubscribe
SourceForge, Inc.
650 Castro Street, Suite 450
Mountain View, CA  94041

Unsubscribe requests will be processed within 10 days of receipt.



-- 
Regards
___
Shivaraj
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


[BangPypers] Help Python framework for report creation (bar graph, pie etc)

2009-09-16 Thread Jins Thomas
Hi all,

I'm relatively a newbie to python. But i do read most of the posts in this
list.  Currently I'm doing a study on developing one reporting framework to
pull the data from the database and project in appealing way like pie
charts, normal charts, bar graphs etc.

Would any body please comment on some good frameworks in python (web based
GUI), which is already available on which i can add my customizations. This
is to replace one of the reporting frameworks provided by Business Objects
Web Intelligence.

Any comments on where to start, how to start are much appreciated. Please
help.


Many Thanks
Jins Thomas
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Help Python framework for report creation (bar graph, pie etc)

2009-09-16 Thread Santhosh Divakar
For plotting you can use gnuplot or pychart.

Now for my project I used both gnuplot and pychart , but went with pychart
since the latter is easier to integrate with a web-framework. I can ask
pychart to give me the output in a PNG format and I can use that in a web
page. The documentation of pychart are pretty simple and straightforward.

-Hope This Helps
Santhosh

On Wed, Sep 16, 2009 at 7:48 PM, Jins Thomas  wrote:


> I'm relatively a newbie to python. But i do read most of the posts in this
> list.  Currently I'm doing a study on developing one reporting framework to
> pull the data from the database and project in appealing way like pie
> charts, normal charts, bar graphs etc.
>
>
>
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Help Python framework for report creation (bar graph, pie etc)

2009-09-16 Thread sudhakar s
For generating reports u can use ReportLab. you can easily generate pie
charts, normal charts, bar graph based on the data present in database.

>From report u can incorporate into web based application.



On Wed, Sep 16, 2009 at 7:48 PM, Jins Thomas  wrote:

> Hi all,
>
> I'm relatively a newbie to python. But i do read most of the posts in this
> list.  Currently I'm doing a study on developing one reporting framework to
> pull the data from the database and project in appealing way like pie
> charts, normal charts, bar graphs etc.
>
> Would any body please comment on some good frameworks in python (web based
> GUI), which is already available on which i can add my customizations. This
> is to replace one of the reporting frameworks provided by Business Objects
> Web Intelligence.
>
> Any comments on where to start, how to start are much appreciated. Please
> help.
>
>
> Many Thanks
> Jins Thomas
>
>
>
> ___
> BangPypers mailing list
> BangPypers@python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>
>


-- 
With Regards,
S Sudhakar.
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Help Python framework for report creation (bar graph, pie etc)

2009-09-16 Thread Pradeep Gowda
On Wed, Sep 16, 2009 at 10:24 AM, Santhosh Divakar
 wrote:
> For plotting you can use gnuplot or pychart.
>
> Now for my project I used both gnuplot and pychart , but went with pychart
> since the latter is easier to integrate with a web-framework. I can ask
> pychart to give me the output in a PNG format and I can use that in a web
> page. The documentation of pychart are pretty simple and straightforward.
>
> -Hope This Helps
> Santhosh
>
> On Wed, Sep 16, 2009 at 7:48 PM, Jins Thomas  wrote:
>
>>
>> I'm relatively a newbie to python. But i do read most of the posts in this
>> list.  Currently I'm doing a study on developing one reporting framework to
>> pull the data from the database and project in appealing way like pie
>> charts, normal charts, bar graphs etc.


If you are looking for "Web" charts, with some level of interactivity, look
at Open Flash Charts 2 http://teethgrinder.co.uk/open-flash-chart-2/

You can Use Python on the server side (regardless of the web framework
you choose)
with the PyOFC2 library (I wrote it). http://btbytes.github.com/pyofc2/

Example of using PyOFC2 with Django:
http://github.com/btbytes/djofc2_demo/tree/master


If you need more interactivity/options look at FusionCharts Version 2
(free) V3 ($)
or Adobe Flex charts (many $$).

+PG
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Help Python framework for report creation (bar graph, pie etc)

2009-09-16 Thread Noufal Ibrahim
On Wed, Sep 16, 2009 at 7:48 PM, Jins Thomas  wrote:
> Hi all,
>
> I'm relatively a newbie to python. But i do read most of the posts in this
> list.  Currently I'm doing a study on developing one reporting framework to
> pull the data from the database and project in appealing way like pie
> charts, normal charts, bar graphs etc.

[..]

One option for charts is pygooglechart which is a thin layer around
the Google charts API.


-- 
~noufal
http://nibrahim.net.in
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Help Python framework for report creation (bar graph, pie etc)

2009-09-16 Thread Pradeep Gowda
On Wed, Sep 16, 2009 at 11:31 AM, Noufal Ibrahim  wrote:
> On Wed, Sep 16, 2009 at 7:48 PM, Jins Thomas  wrote:
>> Hi all,
>>
>> I'm relatively a newbie to python. But i do read most of the posts in this
>> list.  Currently I'm doing a study on developing one reporting framework to
>> pull the data from the database and project in appealing way like pie
>> charts, normal charts, bar graphs etc.
>
> [..]
>
> One option for charts is pygooglechart which is a thin layer around
> the Google charts API.

Doesn't pygooglechart require  you to fetch images from google severs
every time?

This also reminds me of YUI charts which recently(v2.8) added Dual
axis chart support.
YUI is flash based.

http://developer.yahoo.com/yui/charts/
http://www.yuiblog.com/blog/2009/09/14/yui-2-8-0/

+PG
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Help Python framework for report creation (bar graph, pie etc)

2009-09-16 Thread Carl Karsten
For the row/column text reports,
http://dabodev.com/wiki/ReportDesigner (if there were docs, thats
where they would be.  there is a .mov somewhere on the site)

dabo is meant for making wx apps, but I have used the wx based report
IDE to generate the .rfxml layout files and hook those into websites
to generate pdfs.

Here are 2 examples of "make pdf on webserver" code:

http://bazaar.launchpad.net/~yarkot1/web2conf/badge_support/annotate/head%3A/controllers/badge.py#L142

https://pycon.coderanger.net/browser/django/trunk/pycon/badges/views.py#L157



On Wed, Sep 16, 2009 at 9:32 AM, sudhakar s  wrote:
> For generating reports u can use ReportLab. you can easily generate pie
> charts, normal charts, bar graph based on the data present in database.
>
> From report u can incorporate into web based application.
>
>
>
> On Wed, Sep 16, 2009 at 7:48 PM, Jins Thomas  wrote:
>>
>> Hi all,
>>
>> I'm relatively a newbie to python. But i do read most of the posts in this
>> list.  Currently I'm doing a study on developing one reporting framework to
>> pull the data from the database and project in appealing way like pie
>> charts, normal charts, bar graphs etc.
>>
>> Would any body please comment on some good frameworks in python (web
>> based  GUI), which is already available on which i can add my
>> customizations. This is to replace one of the reporting frameworks provided
>> by Business Objects Web Intelligence.
>>
>> Any comments on where to start, how to start are much appreciated. Please
>> help.
>>
>>
>> Many Thanks
>> Jins Thomas
>>
>>
>>
>> ___
>> BangPypers mailing list
>> BangPypers@python.org
>> http://mail.python.org/mailman/listinfo/bangpypers
>>
>
>
>
> --
> With Regards,
> S Sudhakar.
>
> ___
> BangPypers mailing list
> BangPypers@python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>
>



-- 
Carl K
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Help Python framework for report creation (bar graph, pie etc)

2009-09-16 Thread Carl Karsten
On Wed, Sep 16, 2009 at 11:45 AM, Carl Karsten  wrote:
> For the row/column text reports,
> http://dabodev.com/wiki/ReportDesigner (if there were docs, thats
> where they would be.  there is a .mov somewhere on the site)

http://dabodev.com/documentation

# Report Designer Overview, Part 2 (Paul, 2006-02-17, 10 minutes)
# Report Designer Overview (Paul, 2006-02-13, 23 minutes)


>
> dabo is meant for making wx apps, but I have used the wx based report
> IDE to generate the .rfxml layout files and hook those into websites
> to generate pdfs.
>
> Here are 2 examples of "make pdf on webserver" code:
>
> http://bazaar.launchpad.net/~yarkot1/web2conf/badge_support/annotate/head%3A/controllers/badge.py#L142
>
> https://pycon.coderanger.net/browser/django/trunk/pycon/badges/views.py#L157
>
>
>
> On Wed, Sep 16, 2009 at 9:32 AM, sudhakar s  wrote:
>> For generating reports u can use ReportLab. you can easily generate pie
>> charts, normal charts, bar graph based on the data present in database.
>>
>> From report u can incorporate into web based application.
>>
>>
>>
>> On Wed, Sep 16, 2009 at 7:48 PM, Jins Thomas  wrote:
>>>
>>> Hi all,
>>>
>>> I'm relatively a newbie to python. But i do read most of the posts in this
>>> list.  Currently I'm doing a study on developing one reporting framework to
>>> pull the data from the database and project in appealing way like pie
>>> charts, normal charts, bar graphs etc.
>>>
>>> Would any body please comment on some good frameworks in python (web
>>> based  GUI), which is already available on which i can add my
>>> customizations. This is to replace one of the reporting frameworks provided
>>> by Business Objects Web Intelligence.
>>>
>>> Any comments on where to start, how to start are much appreciated. Please
>>> help.
>>>
>>>
>>> Many Thanks
>>> Jins Thomas
>>>
>>>
>>>
>>> ___
>>> BangPypers mailing list
>>> BangPypers@python.org
>>> http://mail.python.org/mailman/listinfo/bangpypers
>>>
>>
>>
>>
>> --
>> With Regards,
>> S Sudhakar.
>>
>> ___
>> BangPypers mailing list
>> BangPypers@python.org
>> http://mail.python.org/mailman/listinfo/bangpypers
>>
>>
>
>
>
> --
> Carl K
>



-- 
Carl K
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] [Inpycon] PyCon blog

2009-09-16 Thread Anand Balachandran Pillai
Done.

http://pycon.blogspot.com/2009/09/just-one-week-to-go-for-pycon-india.html

Can others also spread the word around ? If you have twitter accounts,
please use it to the fullest. Also guys with blogs on planet python etc,
please make noise. Those on facebook can post articles on PyCon.

Ramdas, have we talked with any newspapers yet ?

Thanks

--Anand

PS: X-posted to BangPypers also.

On Tue, Sep 15, 2009 at 11:49 PM, Noufal Ibrahim  wrote:

> Can someone update the PyCon blog with a "one week to go" kind of post?
>
> --
> ~noufal
> http://nibrahim.net.in
> ___
> Inpycon mailing list
> inpy...@python.org
> http://mail.python.org/mailman/listinfo/inpycon
>



-- 
--Anand
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] [Inpycon] PyCon blog

2009-09-16 Thread Kumar Gaurav
The dates on the blog have to be corrected. On the blog it is NOV 26,27.

On Thu, Sep 17, 2009 at 8:46 AM, Anand Balachandran Pillai <
abpil...@gmail.com> wrote:

> Done.
>
> http://pycon.blogspot.com/2009/09/just-one-week-to-go-for-pycon-india.html
>
> Can others also spread the word around ? If you have twitter accounts,
> please use it to the fullest. Also guys with blogs on planet python etc,
> please make noise. Those on facebook can post articles on PyCon.
>
> Ramdas, have we talked with any newspapers yet ?
>
> Thanks
>
> --Anand
>
> PS: X-posted to BangPypers also.
>
> On Tue, Sep 15, 2009 at 11:49 PM, Noufal Ibrahim  wrote:
>
>> Can someone update the PyCon blog with a "one week to go" kind of post?
>>
>> --
>> ~noufal
>> http://nibrahim.net.in
>> ___
>> Inpycon mailing list
>> inpy...@python.org
>> http://mail.python.org/mailman/listinfo/inpycon
>>
>
>
>
> --
> --Anand
>
>
>
>
> ___
> BangPypers mailing list
> BangPypers@python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>
>


-- 
Kumar Gaurav
Developer
http://www.kumargaurav.info
Latest Post -- Gitting things right
http://wp.me/pbU2Q-2j
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Help Python framework for report creation (bar graph, pie etc)

2009-09-16 Thread Balamurugan S
On Wed, Sep 16, 2009 at 7:48 PM, Jins Thomas  wrote:
> Would any body please comment on some good frameworks in python (web based
> GUI), which is already available on which i can add my customizations. This
> is to replace one of the reporting frameworks provided by Business Objects
> Web Intelligence.

You can try python-gdchart2 which is relatively easy to use. More
information at,
http://archive.nexenta.org/elatte-unstable/python/python-gdchart2

-- 
Regards,

S.Balamurugan

Free the code, Free the User
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] [Inpycon] PyCon blog

2009-09-16 Thread Anand Balachandran Pillai
On Thu, Sep 17, 2009 at 9:46 AM, Kumar Gaurav  wrote:

> The dates on the blog have to be corrected. On the blog it is NOV 26,27.
>

 Good catch. Fixed.


>
>
>
-- 
--Anand
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers