Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Cannot convert Python object to 'Handle *'
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
RC  
View profile  
 More options Nov 6 2012, 1:07 am
From: RC <ravi...@gmail.com>
Date: Mon, 5 Nov 2012 22:07:20 -0800 (PST)
Local: Tues, Nov 6 2012 1:07 am
Subject: Cannot convert Python object to 'Handle *'

I am trying to wrap a cpp lib into cython. Here are some details:

Handle.h:

class Handle {
    public:
       // accessors
       // mutators  

};

class Store {
     public:
         Handle* lookup(char* handleName);
         int update(Handle*);

};

handle.pyx:

cdef extern from "Handle.h" namespace "xxx":
    cdef cppclass Handle:
            ....

cdef extern from "Handle.h" namespace "xxx":
   cdef cppclass Store:
          Handle* lookup(char*)
          int update(Handle*)

cdef class PyHandle:

cdef class PyStore:
    cdef Store* store
    def __cinit__(self):
        store = ....
    def lookup(self, name):
         handle = self.store.lookup(name)
         pHandle = PyHandle()
         pHandle.handle = handle
         return pHandle
    def update(self, h):
        self.store.update(h.handle)

the last statement is giving me an error saying "Cannot convert Python
object to 'Handle *'". I know i am missing something simple. How do i pass
the handle* that is embedded in the python object to the call?

Thanks.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robert Bradshaw  
View profile  
 More options Nov 6 2012, 2:45 am
From: Robert Bradshaw <rober...@gmail.com>
Date: Mon, 5 Nov 2012 23:45:13 -0800
Local: Tues, Nov 6 2012 2:45 am
Subject: Re: [cython-users] Cannot convert Python object to 'Handle *'

On the vary last line, all it knows is that h is a Python object. You
probably meant to say

    def update(self, PyHandle h):
        self.store.update(h.handle)

- Robert


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
RC  
View profile  
 More options Nov 6 2012, 5:25 pm
From: RC <ravi...@gmail.com>
Date: Tue, 6 Nov 2012 14:25:22 -0800 (PST)
Local: Tues, Nov 6 2012 5:25 pm
Subject: Re: [cython-users] Cannot convert Python object to 'Handle *'

Thanks Robert that works.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »