Is there any way to get setup.py to recognize file extensions like .c++
in lieu of .cpp? I'd love to not have to rename the source files for
the library I'm trying to wrap in a python C extension.
I get:
error: unknown file type '.c++' (from 'parser.c++')
when I type 'python setup.py build'
th
I want to accept a cStringIO object in a function in a python extension
module. How do I do this?
e.g.,
static PyObject *myfunc(PyObject *self, PyObject *args)
{
PyObject *cstringio;
if (!PyArg_ParseTuple(args, "O:cStringIO", &cstringio)) {
PyErr_SetString(PyExc_ValueError,
Suppose I have some sort of context variable that I want to appear in
log messages. E.g.:
logger = logging.getLogger("somelogger")
class SomeOp:
def __init__(self, ctx):
self.ctx = ctx
def method1(self):
logger.info("%s: here's a message", self.ctx)
What's the idiomatic w
I think the following question is clearer.
I want to make it so that method1 below can be transformed:
logger = logging.getLogger("somelogger")
class SomeOp:
def __init__(self, ctx):
self.ctx = ctx
def method1(self):
logger.info("%s: here's a message", self.ctx)
lo
On Sep 12, 10:46 am, Vinay Sajip <[EMAIL PROTECTED]> wrote:
> On 11 Sep, 17:14, [EMAIL PROTECTED] wrote:
>
> > What is the best way to do this, so that I don't have to manually put
> > the self.ctx in the log string in hundreds of different places?
>
> Another way is to generate your log messages v
I'm having a scoping problem. I have a module called SpecialFile,
which defines:
def open(fname, mode):
return SpecialFile(fname, mode)
class SpecialFile:
def __init__(self, fname, mode):
self.f = open(fname, mode)
...
The problem, if it isn't obvioius, is that the open() call in