Questions tagged [pyobject]

This is a type which contains the information Python needs to treat a pointer to an object as an object.

Definition

All object types are extensions of this type. This is a type which contains the information Python needs to treat a pointer to an object as an object. In a normal “release” build, it contains only the object’s reference count and a pointer to the corresponding type object. It corresponds to the fields defined by the expansion of the PyObject_HEAD macro.

Documentation

Common Object Structures

70 questions
0
votes
0 answers

Why the PyObject is NULL after creation?

I have declared this function: PyObject * A::func(const void *data) const { const time_t *time = reinterpret_cast(data); std::tm *now = std::gmtime(time); PyObject *date_py =…
0
votes
1 answer

Python Objects in C++ DLL

I coded a C++ DLL to use in MQL4. I have to use some python modules. DLL Code: #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers //#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION #include #include…
Behdad
  • 1,459
  • 3
  • 24
  • 36
0
votes
1 answer

Trying to publish C data through a Python Script

I have been trying to publish some bounding box data (from the YOLOv2 neural network) and have been having some problems with publishing some values to a python script. image.c code: #include "image.h" #include "utils.h" #include "blas.h" #include…
Guy997
  • 1
  • 2
0
votes
1 answer

SystemError: NULL result Multiprocessing Python

I am using a Multiprocessing pool to train machine learners. Each LearnerRun object gets a learner, a dictionary of hyperparameters, a name, some more options in an other options dictionary, the name of a directory to write results to, a set of IDs…
Pavel Komarov
  • 1,153
  • 12
  • 26
0
votes
3 answers

How can convert PyObject variable to Mat in c++ opencv code

I have a c++ facerecognition code and a python code in opencv. In python code i read frames from a robot and i want to send this fram to my c++ code. I use this link tho call python function in c++ function. my c++ function is embed.cpp: #include…
narges
  • 681
  • 2
  • 7
  • 26
0
votes
0 answers

Python C Extension - Memory Leak despite Refcount = 1 on returned PyObjects

I'm repeatedly calling a python module I wrote in C++ using the Python C API. My python program repeatedly calls my module's pyParse function, which does a bunch of stuff and returns a PyTuple that contains more PyTuple objects as elements. Every…
0
votes
1 answer

Defining an inner class using the Python C-API

In Python, it’s straightforward to define an inner class: class MyClass(object): class MyInnerClass(object): pass … which the inner class can be accessed as one would expect, e.g. by doing MyClass.MyInnerClass. I am trying to set up…
fish2000
  • 4,289
  • 2
  • 37
  • 76
0
votes
1 answer

error: value of type 'PyObject' (aka '_object') is not contextually convertible to 'bool'

I am passing a python module to C as a PyObject. I want to check to see if this value is NONE in my C code, using this form: int func(PyObject tmp) { if(tmp) { // etc I am getting the following error. How can I convert from a PyObject…
kilojoules
  • 9,768
  • 18
  • 77
  • 149
0
votes
2 answers

What is the proper usage of PyArg_ParseTuple

I am using what seems to be the exact usgae of PyArg_ParseTuple, yet the code is still failing to work. I am using python 2.7 This is my C code for the Python Extension I am writing: static PyObject* tpp(PyObject* self, PyObject* args) { PyObject*…
Daniel
  • 170
  • 2
  • 11
-1
votes
1 answer

send unsigned char * using PyObject_CallMethod

I'm struggling with PyObject_CallMethod trying to send unsigned char * to python script, but it gives me error calling the method on the python side. I've tried s,s#,s*,y and B formats but with no luck. which format should I use? Here's the…
Alaa Agwa
  • 162
  • 1
  • 12
1 2 3 4
5