PyKDE : Can I embed a Konsole?

Adrian Casey news at
Mon Oct 18 13:19:59 CEST 2004

I'd like to embed a Konsole inside my PyQt-based application. I'm using the
pexpect module extensively and would dearly like to add the ability to read
and write to Konsole sessions from my application (i.e. send commands and
read the output send to Konsole).  I would also like to process the output
stream in the normal 'expect' manner and send appropriate input based on
decisions made.

I've seen examples of embeding the KHTML widget but have not yet seen the
same done with a Konsole.  Has anyone done it?  Is it possible?

My application has the ability to create accounts, set passwords and run
ad-hoc commands across multiple systems - generic 'expect' type
functionality.  The ability to connect the expect stream to a Konsole and
thereby monitor the interaction with the remote systems would be very
handy.  Further, the ability to switch to 'interactive' mode when
exceptions are raised would allow the user to assume 'manual pilot'
operation during unexpected error conditions.

>From the shell, I can use dcop to create new Konsole sessions within
existing Konsole windows.  This is not the ideal solution as it does not
appear possible to connect a 'pexpect' session to a Konsole thus launched. 
Of course, those Konsoles are also external to my application.  Not ideal.

Adrian Casey.
Alice Springs Linux User Group

If you've ever used expect, be sure the take a look at pexpect.  It can be
found at

More information about the Python-list mailing list