[PyKDE] Python and KDE 2

Corrin Lakeland corrin.lakeland at xtra.co.nz
Sat Nov 6 04:28:14 GMT 1999


Hello all,

I'm porting a gnome program to KDE and that program is written as two seperate
components, one graphical and one non graphical.  Both components are written
in Python.

I've decided to rewrite the graphical component in C++ and link into the
non-graphical compnent.  The logic of this is that KDE 2 doesn't have python
bindings yet and may never have them (I don't have KDE 1 installed because it
kept getting in the way of KDE 2).  

Unfortunatly I can't work out how to successfully embed python in C++ and I'm
totally stumped as to what I'm doing wrong:  Some problems:

        bib = bibopen('/work/references/temp.bib')

doesn't work, claiming bibopen isn't found even though I've done all of the
import stuff. I finally found that typing 

        eval(code.compile_command('bibopen("/work/references/temp.bib")\n'),
             user_global)

executes correctly, but returns null.  How can I execute the
command and get the result back?  It isn't much use opening the bibliography
unless I can search it afterwards :-(

How do I call a user-defined function with a PyObject?  e.g. I want to call
search(bib,"foo").  I can see PyObject_CallFunction but I can't work out how to
pass a PyObject through the "..."

After randomly hacking for a couple of weeks I gave up and tried to connect to
python's stdin/stdout rather than embed python, but I couldn't get this working
either: Python doesn't do anything until it gets an EOF.  I would
really appreciate it if somebody could give me a clue as to how to embed python
(e.g. a proper example) or how to set up communication between a python program
and a C++ program.

Corrin (Help! :)
--
Corrin Lakeland <lakeland at cs.otago.ac.nz>             Phone 64 6 876 5219
Department of Computer Science                Faculty of Business Studies
University of Otago, New Zealand      Eastern Institute of Technology, NZ




More information about the PyQt mailing list