[capi-sig] Equivalent of PyByteArray_FromStringAndSize in python2.4
M.-A. Lemburg
mal at egenix.com
Fri Oct 19 15:24:29 CEST 2012
On 19.10.2012 13:36, endeavor john wrote:
> Hello Team,
> While cross-compiling XBMC Apllication.The code is generated using Java.
> I am getting an error :PyByteArray_FromStringAndSize.is undefined, i
> understand that this api is defined in python2.6.
> But we are supposed to compile this with python-2.4 libraries.
>
> Can you please let us know what is the equivalent API in python 2.4.This is
> the Code which using the "PyByteArray_FromStringAndSize" API.
>
> static PyObject* xbmc_XBMCAddon_xbmc_RenderCapture_getImage(PyObject*
> self, PyObject *args, PyObject *kwds)
> {
> RenderCapture* rc =
> ((RenderCapture*)retrieveApiInstance((PyObject*)self,&PyXBMCAddon_xbmc_RenderCapture_Type,"getImage","XBMCAddon::xbmc::RenderCapture"));
> if (rc->GetUserState() != CAPTURESTATE_DONE)
> {
> PyErr_SetString(PyExc_SystemError, "illegal user state");
> return NULL;
> }
>
> ssize_t size = rc->getWidth() * rc->getHeight() * 4;
> return PyByteArray_FromStringAndSize((const char *)rc->GetPixels(), size);
> }
This depends a bit on what the library expects as input elsewhere and
whether the memory area allocation is being managed elsewhere or not.
You could use a PyBuffer_FromReadWriteMemory() or a PyString_FromStringAndSize()
with Python 2.4.
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source (#1, Oct 19 2012)
>>> Python Projects, Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope/Plone.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
2012-09-27: Released eGenix PyRun 1.1.0 ... http://egenix.com/go35
2012-09-26: Released mxODBC.Connect 2.0.1 ... http://egenix.com/go34
2012-09-25: Released mxODBC 3.2.1 ... http://egenix.com/go33
2012-10-23: Python Meeting Duesseldorf ... 4 days to go
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
http://www.egenix.com/company/contact/
More information about the capi-sig
mailing list