printf in python

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Jun 3 21:46:06 EDT 2008


En Tue, 03 Jun 2008 10:28:57 -0300, gianluca <geonomica at gmail.com>  
escribió:
>> > > On Mon, 2 Jun 2008 00:32:33 -0700 (PDT), gianluca  
>> <geonom... at gmail.com>
>> > > declaimed the following in comp.lang.python:
>>
>> > > > Hy, I've a problem with may python library generated with swig  
>> from C
>> > > > code. I works and I can access all function but a  simèple  
>> function
>> > > > that print a string don't work's.
>> > > > The function is like this:
>> > > > int PrintTEST()
>> > > > {
>> > > >      printf("TEST ");
>> > > >      return 1;
>> > > > }
>
> I know!! I'm bore!! But I need help indeed!!
> I'm looking inside lib_wrap.c generated by swig. In the wrap function
> there is no printf function. If is this the problem how can I do to
> resolve it?

Generated swig code is... uhm, ugly at least, and rather undebuggable. I'd  
try to avoid it.
Another alternative is Cython: I've not actually used it myself, but I've  
seen good reports from it.
If your library is written in C (not C++), you may use directly ctypes  
 from inside Python.

-- 
Gabriel Genellina




More information about the Python-list mailing list