WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] python bindings: xen.lowlevel.xc.error

To: Kaleb Pederson <kibab@xxxxxxxxxxxx>
Subject: Re: [Xen-devel] python bindings: xen.lowlevel.xc.error
From: Ewan Mellor <ewan@xxxxxxxxxxxxx>
Date: Thu, 18 May 2006 23:14:56 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 18 May 2006 15:15:20 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20060518193153.GB24931@kibab>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20060518193153.GB24931@kibab>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.9i
On Thu, May 18, 2006 at 12:31:53PM -0700, Kaleb Pederson wrote:

> Hello,
> 
> I don't see any way to get at the exception class that is being used by
> xen.lowlevel.xc.  I wanted to be able to grab just the xen exceptions,
> but it doesn't appear possible:
> 
> >>> import xen.lowlevel.xc as xc
> >>> dir(xc)
> ['__doc__', '__file__', '__name__', 'xc']
> # the only thing listed is the xc class
> 
> # i'm running 3.0.2 using the sedf scheduler, so this should fail
> >>> try:
> ...     x.bvtsched_domain_get(0)
> ... except Exception, e:
> ...     print e.__class__
> ...     print dir(e)
> ...     print dir(e.__class__)
> ...     print e.__module__
> ...     print e.args
> ...
> xen.lowlevel.xc.error
> ['__doc__', '__getitem__', '__init__', '__module__', '__str__',
> 'args']
> ['__doc__', '__getitem__', '__init__', '__module__', '__str__']
> xen.lowlevel.xc
> (22, 'Invalid argument')
> >>> e
> <xen.lowlevel.xc.error instance at 0xb7b78b2c>
> >>> xc.error
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> AttributeError: 'module' object has no attribute 'error'
> 
> Did I miss something?  If not, could the xen.lowlevel.xc.error class be
> publically exposed?

They are exceptions of the built-in type RuntimeError -- that's what you get
when you use PyErr_SetFromErrno in the C layer.  I don't know why it shows up
as xc.error -- presumably that's a Python internal thing.

Ewan.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel