def main(): # copy article to reply f = file(log, "w") f.write(qterm.toUTF8(qterm.copyArticle(lp), "gbk")) f.close() qterm.sendString(lp, "r\n") for i in range(0, 12): qterm.sendString(lp, "") # call external editor subprocess.call([editor, log]) # post back f = file(log, "r") content = "" for i in f.readlines(): content += i f.close() qterm.sendString(lp, qterm.fromUTF8(content, "gbk")) qterm.sendString(lp, "")
def send_char(lp, ch): qterm.sendString(lp, ch) print 'send', ch wait_until_change(lp) wait_until_stable(lp)