[Tutor] open extra xterm?

Abel Daniel abli@freemail.hu
Sun Jan 5 10:11:20 2003


On Sun, Jan 05, 2003 at 03:46:37PM +0100 Abel Daniel (abli@freemail.hu) wrote:
> Not fully in python, but should work:
 [..snipped...]

Ok, here is the fully python version:

import os
os.system('mkfifo /tmp/pipe')
os.system("xterm -e cat /tmp/pipe &")
fo = open("/tmp/pipe","w")

while 1: #for simulating data output 
    i=raw_input('>>')
    fo.write(i + '\n')
    fo.flush()

Of course, using /tmp/pipe silently is not exactly a good idea,
a safer version would find make up an obfuscated name, check if
it's used in /tmp/ and make a pipe with that name, but i'm to tired
to add that.

Abel Daniel
abli@freemail.hu