SourceForge logo
SourceForge logo
Menu

matplotlib-devel — matplotlib developers

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
(1)
Nov
(33)
Dec
(20)
2004 Jan
(7)
Feb
(44)
Mar
(51)
Apr
(43)
May
(43)
Jun
(36)
Jul
(61)
Aug
(44)
Sep
(25)
Oct
(82)
Nov
(97)
Dec
(47)
2005 Jan
(77)
Feb
(143)
Mar
(42)
Apr
(31)
May
(93)
Jun
(93)
Jul
(35)
Aug
(78)
Sep
(56)
Oct
(44)
Nov
(72)
Dec
(75)
2006 Jan
(116)
Feb
(99)
Mar
(181)
Apr
(171)
May
(112)
Jun
(86)
Jul
(91)
Aug
(111)
Sep
(77)
Oct
(72)
Nov
(57)
Dec
(51)
2007 Jan
(64)
Feb
(116)
Mar
(70)
Apr
(74)
May
(53)
Jun
(40)
Jul
(519)
Aug
(151)
Sep
(132)
Oct
(74)
Nov
(282)
Dec
(190)
2008 Jan
(141)
Feb
(67)
Mar
(69)
Apr
(96)
May
(227)
Jun
(404)
Jul
(399)
Aug
(96)
Sep
(120)
Oct
(205)
Nov
(126)
Dec
(261)
2009 Jan
(136)
Feb
(136)
Mar
(119)
Apr
(124)
May
(155)
Jun
(98)
Jul
(136)
Aug
(292)
Sep
(174)
Oct
(126)
Nov
(126)
Dec
(79)
2010 Jan
(109)
Feb
(83)
Mar
(139)
Apr
(91)
May
(79)
Jun
(164)
Jul
(184)
Aug
(146)
Sep
(163)
Oct
(128)
Nov
(70)
Dec
(73)
2011 Jan
(235)
Feb
(165)
Mar
(147)
Apr
(86)
May
(74)
Jun
(118)
Jul
(65)
Aug
(75)
Sep
(162)
Oct
(94)
Nov
(48)
Dec
(44)
2012 Jan
(49)
Feb
(40)
Mar
(88)
Apr
(35)
May
(52)
Jun
(69)
Jul
(90)
Aug
(123)
Sep
(112)
Oct
(120)
Nov
(105)
Dec
(116)
2013 Jan
(76)
Feb
(26)
Mar
(78)
Apr
(43)
May
(61)
Jun
(53)
Jul
(147)
Aug
(85)
Sep
(83)
Oct
(122)
Nov
(18)
Dec
(27)
2014 Jan
(58)
Feb
(25)
Mar
(49)
Apr
(17)
May
(29)
Jun
(39)
Jul
(53)
Aug
(52)
Sep
(35)
Oct
(47)
Nov
(110)
Dec
(27)
2015 Jan
(50)
Feb
(93)
Mar
(96)
Apr
(30)
May
(55)
Jun
(83)
Jul
(44)
Aug
(8)
Sep
(5)
Oct
Nov
(1)
Dec
(1)
2016 Jan
Feb
Mar
(1)
Apr
May
Jun
(2)
Jul
Aug
(3)
Sep
(1)
Oct
(3)
Nov
Dec
2017 Jan
Feb
(5)
Mar
Apr
May
Jun
Jul
(3)
Aug
Sep
(7)
Oct
Nov
Dec
2018 Jan
Feb
Mar
Apr
May
Jun
Jul
(2)
Aug
Sep
Oct
Nov
Dec
S M T W T F S

1
(4)
2
(7)
3
(2)
4
(9)
5
(8)
6
7
8
(6)
9
10
(2)
11
(8)
12
(1)
13
(2)
14
15
16
17
(4)
18
(8)
19
(4)
20
(3)
21
22
(9)
23
(9)
24
(8)
25
(2)
26
(1)
27
28
29
30




Showing 9 results of 9

From: Fernando P. <Fer...@co...> - 2004年11月22日 23:14:56
John Hunter schrieb:
>>>>>>"Fernando" == Fernando Perez <Fer...@co...> writes:
> 
> 
> >> overridden. I don't see any elegant way to do this. Any
> >> ideas?
> 
> Fernando> In [2]: sys.__excepthook__ is sys.excepthook Out[2]:
> 
> Excellent. So if the backends define a function excepthook_backend
> and matplotlib.matlab does
> 
> if sys.__excepthook__ is sys.excepthook:
> sys.excepthook = excepthook_backend
> 
> would we be in reasonably good standing with the python gods and
> others?
You'd have to ask the gods directly, but it looks pretty good to me, a mere 
mortal :)
Best,
f
From: John H. <jdh...@ac...> - 2004年11月22日 23:12:50
>>>>> "Fernando" == Fernando Perez <Fer...@co...> writes:
 >> overridden. I don't see any elegant way to do this. Any
 >> ideas?
 Fernando> In [2]: sys.__excepthook__ is sys.excepthook Out[2]:
Excellent. So if the backends define a function excepthook_backend
and matplotlib.matlab does
if sys.__excepthook__ is sys.excepthook:
 sys.excepthook = excepthook_backend
would we be in reasonably good standing with the python gods and
others?
JDH
From: Fernando P. <Fer...@co...> - 2004年11月22日 23:08:45
John Hunter schrieb:
>>>>>>"Fernando" == Fernando Perez <Fer...@co...> writes:
> 
> 
> >> Actually, it would be fine if matplotlib overrode
> >> sys.except_hook and ipython later came along and overrode that.
> >> Basically, ipython would be saying, "I know I've got a shell to
> >> display errors in, so we don't need to GUI method". I don't
> >> think matplotlib would have a problem with that. Ditto for
> >> envisage. Basically, we would be providing a default method to
> >> get the message to the GUI which could be overriden by other
> >> applications that want to (ipython, envisage, what-have-you).
> 
> Fernando> I guess this is a good heads-up for me. I know ipython
> Fernando> does some of this, I'll just add a bit more such
> Fernando> control. That way, if during the running of user code
> Fernando> they need sys.ehook for something, they'll get it. But
> Fernando> ipython will keep it for when it needs it. I'm pretty
> Fernando> sure the embeddable ipython has such control in it, I
> Fernando> may just need to put it in the general case as well.
> 
> Fernando> Ultimately I'm not 100% sure what a good solution for
> Fernando> matplotlib is, I just wanted to make you aware of these
> Fernando> issues, so that at least they are on your radar.
> 
> 
> We do have some more options. For one, we could use the excepthook
> only in the matlab interface -- in this case matlab is being used more
> as an application rather than a library. Folks using matplotlib as a
> library, eg embedding in a GUI, would be advised to do their own
> trapping.
> 
> The only exceptional case I see is basically the ipython (and friends)
> case. Ie, someone wants to write a shell or otherwise that embeds
> matplotlib.matlab. In this case it would be fine to override
> matplotlib.matlab's excepthook, as discussed.
> 
> To play really nicely, matplotlib.matlab would like to be able to
> override excepthook only if it hadn't been otherwise overridden. I
> don't see any elegant way to do this. Any ideas?
Yup:
planck[mayavi]> ip
In [1]: import sys
In [2]: sys.__excepthook__ is sys.excepthook
Out[2]: False
planck[mayavi]> python
 >>> import sys
 >>> sys.__excepthook__ is sys.excepthook
True
Cheers,
f
From: John H. <jdh...@ac...> - 2004年11月22日 23:05:34
>>>>> "Fernando" == Fernando Perez <Fer...@co...> writes:
 >> Actually, it would be fine if matplotlib overrode
 >> sys.except_hook and ipython later came along and overrode that.
 >> Basically, ipython would be saying, "I know I've got a shell to
 >> display errors in, so we don't need to GUI method". I don't
 >> think matplotlib would have a problem with that. Ditto for
 >> envisage. Basically, we would be providing a default method to
 >> get the message to the GUI which could be overriden by other
 >> applications that want to (ipython, envisage, what-have-you).
 Fernando> I guess this is a good heads-up for me. I know ipython
 Fernando> does some of this, I'll just add a bit more such
 Fernando> control. That way, if during the running of user code
 Fernando> they need sys.ehook for something, they'll get it. But
 Fernando> ipython will keep it for when it needs it. I'm pretty
 Fernando> sure the embeddable ipython has such control in it, I
 Fernando> may just need to put it in the general case as well.
 Fernando> Ultimately I'm not 100% sure what a good solution for
 Fernando> matplotlib is, I just wanted to make you aware of these
 Fernando> issues, so that at least they are on your radar.
We do have some more options. For one, we could use the excepthook
only in the matlab interface -- in this case matlab is being used more
as an application rather than a library. Folks using matplotlib as a
library, eg embedding in a GUI, would be advised to do their own
trapping.
The only exceptional case I see is basically the ipython (and friends)
case. Ie, someone wants to write a shell or otherwise that embeds
matplotlib.matlab. In this case it would be fine to override
matplotlib.matlab's excepthook, as discussed.
To play really nicely, matplotlib.matlab would like to be able to
override excepthook only if it hadn't been otherwise overridden. I
don't see any elegant way to do this. Any ideas?
JDH
From: Fernando P. <Fer...@co...> - 2004年11月22日 22:58:54
John Hunter schrieb:
>>>>>>"Fernando" == Fernando Perez <Fer...@co...> writes:
> 
> 
> 
> Fernando> I realize that excepthook is a tempting tool to use, but
> Fernando> I hope you guys reconsider this. I really think it
> Fernando> would cause many more headaches down the road than those
> Fernando> it initially appears to solve.
> 
> OK, good to know. That was news to me. Now why is it that ipython
> and envisage get to mess around with it and we don't :-) ?
> 
> So what is the canonical way to funnel exceptions into GUI dialog
> boxes? Isn't this what sys.except_hook is for?
Mmh, I don't really know for sure. But here's a quick test:
planck[mayavi]> egrep -r sys.except *
planck[mayavi]>
This is on the mayavi sources. Mayavi DOES show all VTK exceptions into a GUI 
(such as you get when you try to open the volume rendering module with 
floating point data, for example). I imagine it just traps them locally, but 
I'm not sure. It is possible that mayavi has an easier job because it's done 
in Tk, with no threading issues to worry about. Threads make this problem 
MUCH worse, since python has no sensible way for an exception raised in one 
thread to be handled by another: all go to the sys.excepthook bucket. There 
have been long, complicated threads recently on c.l.py on the cousin topics of 
signals and exceptions in threads, and it doesn't look pretty.
> Actually, it would be fine if matplotlib overrode sys.except_hook and
> ipython later came along and overrode that. Basically, ipython would
> be saying, "I know I've got a shell to display errors in, so we don't
> need to GUI method". I don't think matplotlib would have a problem
> with that. Ditto for envisage. Basically, we would be providing a
> default method to get the message to the GUI which could be overriden
> by other applications that want to (ipython, envisage, what-have-you).
I guess this is a good heads-up for me. I know ipython does some of this, 
I'll just add a bit more such control. That way, if during the running of 
user code they need sys.ehook for something, they'll get it. But ipython will 
keep it for when it needs it. I'm pretty sure the embeddable ipython has such 
control in it, I may just need to put it in the general case as well.
Ultimately I'm not 100% sure what a good solution for matplotlib is, I just 
wanted to make you aware of these issues, so that at least they are on your radar.
Best,
f
From: John H. <jdh...@ac...> - 2004年11月22日 22:50:48
>>>>> "Fernando" == Fernando Perez <Fer...@co...> writes:
 Fernando> I realize that excepthook is a tempting tool to use, but
 Fernando> I hope you guys reconsider this. I really think it
 Fernando> would cause many more headaches down the road than those
 Fernando> it initially appears to solve.
OK, good to know. That was news to me. Now why is it that ipython
and envisage get to mess around with it and we don't :-) ?
So what is the canonical way to funnel exceptions into GUI dialog
boxes? Isn't this what sys.except_hook is for?
Actually, it would be fine if matplotlib overrode sys.except_hook and
ipython later came along and overrode that. Basically, ipython would
be saying, "I know I've got a shell to display errors in, so we don't
need to GUI method". I don't think matplotlib would have a problem
with that. Ditto for envisage. Basically, we would be providing a
default method to get the message to the GUI which could be overriden
by other applications that want to (ipython, envisage, what-have-you).
So I don't really see a danger here, but please educate me!
JDH
From: Fernando P. <Fer...@co...> - 2004年11月22日 22:43:21
John Hunter schrieb:
>>>>>>"Steve" == Steve Chaplin <ste...@ya...> writes:
> 
> 
> Steve> By subclassing Verbose you group all the functions that
> Steve> display messages to the user together into one class. I
> Steve> may have misunderstood some of the discussion - I agree
> Steve> with doing all error handling with exceptions, but when you
> Steve> catch the exception in a GUI I'm assuming you still want to
> Steve> popup a message to inform the user. Are you describing
> Steve> using exceptions and tracebacks without any error messages
> Steve> for GUI backends? I don't think you can assume a GUI
> Steve> backend user will see a traceback since the terminal window
> Steve> may be obscured, iconified or even closed.
> 
> For the GUI error handling, I was assuming we would use the
> except_hook, and do away with error reporting in the verbose class.
I'd like to strongly plead that you stay away from sys.excepthook.
That is the 'last resort' tool to manipulate exceptions, and it's typically 
used by frameworks which need to completely control the python process. For 
example, ipython puts its internal crash handler in sys.excepthook, so that if 
all else fails, the crash handler generates a very detailed crash report. But 
all 'normal' exception handling is done by the internal user loop, with manual 
control.
I haven't had time to look in detail, but I even think that ipython pretty 
aggressively reclaims sys.excepthook if user code messes with it. I wouldn't 
be surprised if other frameworks (like envisage) also used sys.excepthook 
themselves. Matplotlib is 'only' a plotting library :), and it should IMHO 
play nicely with other code running along with it. If it gets into a 
foodfight over who owns sys.excepthook, or if it crashes because 
sys.excepthook is not what it thinks it is, I expect serious interoperability 
problems to pop up down the road.
I realize that excepthook is a tempting tool to use, but I hope you guys 
reconsider this. I really think it would cause many more headaches down the 
road than those it initially appears to solve.
Regards,
f
From: John H. <jdh...@ac...> - 2004年11月22日 21:58:15
>>>>> "Steve" == Steve Chaplin <ste...@ya...> writes:
 Steve> By subclassing Verbose you group all the functions that
 Steve> display messages to the user together into one class. I
 Steve> may have misunderstood some of the discussion - I agree
 Steve> with doing all error handling with exceptions, but when you
 Steve> catch the exception in a GUI I'm assuming you still want to
 Steve> popup a message to inform the user. Are you describing
 Steve> using exceptions and tracebacks without any error messages
 Steve> for GUI backends? I don't think you can assume a GUI
 Steve> backend user will see a traceback since the terminal window
 Steve> may be obscured, iconified or even closed.
For the GUI error handling, I was assuming we would use the
except_hook, and do away with error reporting in the verbose class.
For the regular verbose reporting, I'm not averse to plugging it into
a GUI dialog, but I'm not sure this is useful. As I wrote before,
this will mainly be used in debug situations when we can probably
assume a user has access to a shell output. They can always capture
it to a file using the regular rc mechanism of setting verbose.fileo.
If we did want to do it in a GUI, we would have to be fairly careful
about the implementation, so that the GUI cached sequential methods
and only displayed them if some time interval (eg 100ms) had lapsed
with no new messages. This would be used to prevent the curse of 20
popups. This could presumably be done in GTK with an idle handler and
a changed timestamp.
Alternatively, it could be done in the verbose base class itself,
implemented using threads, but I'm a little wary of the extra
complexity here. 
That said, I think that having the figure manager define a
popup_dialog method would be generally useful. 
 Steve> It does look like they are all non-fatal. I guess the fatal
 Steve> ones are the ones that matplotlib does not anticipate or
 Steve> catch, thinks like faulty installations, missing libraries
 Steve> etc. At the moment these would cause matplotlib to
 Steve> terminate but if we add a default exception handler we will
 Steve> start catching these also. We could have a policy for
 Steve> matplotlib to catch all exceptions and always attempt to
 Steve> continue, and if it becomes unusable its up to the user to
 Steve> close the window. Also we could recognise some situations
 Steve> (if there are any) where we need to terminate, so we raise
 Steve> SystemExit and set the default exception handler to
 Steve> terminate on SystemExit and continue on all other cases.
Sounds right to me.... So in summary, if all agree and we've covered
all the bases, Verbose.report_error and error_msg disappear and are
replaced by regular exceptions. matplotlib code can raise a
SystemExit for the relatively rare fatal errors. GUIs define
sys.excepthook = exception_handler following the lead of Steve's
implementation in backend_gtk (in CVS).
verbose.report is left untouched for now but may be hooked into a GUI
reporting functionality if we can resolve the issues of whether this
is desirable and how to handle caching of many independent sequential
messages.
JDH
From: Steve C. <ste...@ya...> - 2004年11月22日 09:08:10
On Sat, 2004年11月20日 at 17:26 -0600, John Hunter wrote:
> As for report_error, subclassing Verbose, or using figure manager for
> this as Jochen has suggested, are both workable solutions, but what
> does it ultimately buy us? I am inclined to the logically cleaner
> solution of doing all error handling with exceptions, using a hook
> like you've provided for GUIs.
By subclassing Verbose you group all the functions that display messages
to the user together into one class.
I may have misunderstood some of the discussion - I agree with doing all
error handling with exceptions, but when you catch the exception in a
GUI I'm assuming you still want to popup a message to inform the user.
Are you describing using exceptions and tracebacks without any error
messages for GUI backends? I don't think you can assume a GUI backend
user will see a traceback since the terminal window may be obscured,
iconified or even closed.
> I grepped for all the current uses of report error (included below) --
> on quick inspection none of these appear fatal for a GUI. I think
> simply informing the user of the error may suffice. Can you provide
> an example of where we may need to exit (and would it suffice for the
> raiser to simply raise a SystemExit for this case?)
It does look like they are all non-fatal. I guess the fatal ones are the
ones that matplotlib does not anticipate or catch, thinks like faulty
installations, missing libraries etc. At the moment these would cause
matplotlib to terminate but if we add a default exception handler we
will start catching these also.
We could have a policy for matplotlib to catch all exceptions and always
attempt to continue, and if it becomes unusable its up to the user to
close the window. Also we could recognise some situations (if there are
any) where we need to terminate, so we raise SystemExit and set the
default exception handler to terminate on SystemExit and continue on all
other cases.
Steve

Showing 9 results of 9

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /