named '__builtin__._'.
> So, ``del _`` may help you.
>
> This behavior is only on interactive shell. When running script, '_'
> is not used and Python
> may acts you expect.
>
>
> On Mon, Apr 18, 2011 at 9:56 AM, Charles Solar
> wrote:
> > I
8:06 PM, Stefan Seefeld wrote:
> On 2011-04-17 20:56, Charles Solar wrote:
>
>>
>> Is there something I should be aware of here?
>>
>
> Just that Python uses garbage collection and you mustn't rely on your
> objects being destroyed at a particular point in
I have a python module written in C++, and the C++ code has a few instances
that involve method chaining. I was experimenting with python support for
these methods and I found something odd.
However it seems this is more a python eccentricity than Boost Python,
consider the following code sample.
This happens in my application as well, dont know if its a known issue for
boost python or not..
I too would like to see a solution; I myself have not had anytime to look
into it since exceptions are a rare thing in my app.
I can confirm however that a similar problem occurs on Solaris Sparcv9
mach
I have a class interface I expose to python that has methods such as begin,
end, rbegin, rend. Its meant to be a class that C++ can iterate over. I
now want to make the object defined in python, so python can pass the C++
library an object of python's class and C++ can use it like it would any
re
You need to link with libpython as well. libpython should resolve these.
On Wed, Oct 6, 2010 at 5:43 AM, Philipp Münzel wrote:
> Oh crap, the command that links is of course:
>
> $ g++ -shared -Wl,-soname,"libhello.so" -L/usr/local/lib -lboost_python
> -o libhello.so hello.o
>
> But I get the un
You need to compile boost python with a 32 bit version of python. The
version bjam is finding is 64 bit. If you have a 32 bit python
somewhere you need to tell bjam where to find the right headers. See
this page
http://www.boost.org/doc/libs/1_44_0/libs/python/doc/building.html#configuring-boos
I have a bp::wrapper wrapping an interface for use in python. Several
functions return reference types of other objects, for example:
class IFoo
{
virtual const IBar& getBar() const = 0;
}
I found that to get boost python to handle this scenario correctly and
eliminate any 'returning address
Use the python special function __getitem__
So, something like this:
.def( "__getitem__", &Foo::operator[], boost::python::arg( "index" ),
boost::python::return_internal_reference<>() )
If you want your container iteratable, see the docs for boost::python::range.
Charles
On Wed, Sep 8, 2010 at
You need to link with boost python as well.
g++ boostpy.cc -lpython2.5 -lboost_python -I /usr/include/python2.5
-o boostpy.so -shared
should probably do the trick
On Mon, Aug 30, 2010 at 12:19 PM, Junwei Zhang
wrote:
> Hi, everyone,
>
> I just started study boost.python. and have following pro
I mentioned it before but I have this patch for boost python that adds
code to lock and unlock the gil at all the boundaries I have found
between python and boost python. This makes it so multiple threads
can call into python without the user having to lock and unlock the
gil themselves. I am pre
Threads and python do not mix very well. You need to handle locking and
unlocking the gil at the boundaries of python and c++.
There are several posts here about this problem, just search for thread or
'no current thread' in the archives.
A month ago I posted a modified boost python that will hand
wrote:
> On 06/09/2010 03:11 PM, Charles Solar wrote:
>
>> I have a boost python library that I build python scripts with. I am not
>> embedding python, I think that is worth mentioning right off the bat.
>> In my C++ library I have a separate thread calling into python
>
I have a boost python library that I build python scripts with. I am not
embedding python, I think that is worth mentioning right off the bat.
In my C++ library I have a separate thread calling into python occasionally
and I am finding that if the function I call in python has a python error in
it
you can only access python from 1 thread at a time. I have not done any
messing around with python types so I do not know if those require the gil
but from what you said it seems like they may.
In order to work with python from multiple threads you need to manage the
gil in your app. Just do a sear
No you can do this, I do the same thing in my project.
However, without appropriate GIL locks your new thread cannot call into
python. So make sure your new thread of not calling any python callables
and you are fine.
On Sun, Jun 6, 2010 at 2:30 PM, Embhi Karuche wrote:
> Hello
>
> I have read t
there. :)
On Thu, Jun 3, 2010 at 9:57 AM, Charles Solar wrote:
> I am getting a boost exception when I try to import my project linked with
> boost python. It occurs in the python _init method so I am pretty sure it
> has something to do with boost python. I get this exception:
>
&
I am getting a boost exception when I try to import my project linked with
boost python. It occurs in the python _init method so I am pretty sure it
has something to do with boost python. I get this exception:
terminate called after throwing an instance of
'boost::exception_detail::clone_impl'
I was not originally going to say anything but from what i have skimmed from
all these emails seems like someone really needs multithread safety in boost
python. Turns out I needed the same thing about 2 months ago, and I looked
at TnFOX, changed a few things, patched a couple files, and I am fair
I have some virtual methods with default implementations that I am defining
according the guidelines on the documentation and I ran into some unexpected
behavior.
If I define a virtual method in boost python like so
void receivedMsg( const sl::Message& msg )
{
if( bp::override func_receive
If you want to wrap the library in C I believe you will have to use the
standard python API, as boost requires C++ features.
It sounds like you do not want to write a wrapper library and instead add
code to leptonica to make it python import-able. I would not suggest this
approach.
If you want to
de though, so no rush on Py++
support, although I bet its as easy as generating a patch or something..
Anyway, great tool, great advice, thanks again.
On Mon, Feb 1, 2010 at 1:40 PM, Roman Yakovenko
wrote:
> On Mon, Feb 1, 2010 at 5:22 PM, Charles Solar
> wrote:
> > I have a method tha
I have a method that takes a boost function object as so
bool createTimer( boost::int64_t interval, boost::function< bool() >
function, bool recurring = false )
that I would like to call in python. I tried exporting the class in Py++
but it did not look like it does anything special with that ar
using and could not find an example of
member function default params is here
http://www.boost.org/doc/libs/1_41_0/libs/python/doc/tutorial/doc/html/python/functions.html#python.default_arguments
perhaps it would be nice to note this very handy bp::object somewhere.
Thanks
On Tue, Jan 12, 2010 at
Looks perfect, thanks much.
On Tue, Jan 12, 2010 at 2:01 PM, troy d. straszheim wrote:
> Charles Solar wrote:
>
>> Well I want to define the overloads myself anyway, I just do not know how
>> to properly setup the small wrapper that will work. In the doc it tells you
&
Meine wrote:
> On Dienstag 12 Januar 2010, Charles Solar wrote:
> > I have a few default parameters in a couple of my member functions, and
> > these functions do not conform to the format required
> > forBOOST_PYTHON_MEMBER_FUNCTION_OVERL
I have a few default parameters in a couple of my member functions, and
these functions do not conform to the format required
forBOOST_PYTHON_MEMBER_FUNCTION_OVERLOAD..
I was wondering how to go about creating those thin wrappers for these
functions.
For example, my class would be something like
Its getting kind of late and my eyes are getting tired so I wanted to throw
up this problem I am having and see if I can get some feedback on what might
be going wrong here.
I built boost::python into my app and exported a bunch of stuff. All is
well when I just call functions and do not much at
28 matches
Mail list logo