看板 Python 關於我們 聯絡資訊
呃... 我也覺得標題很爛, 請大家提示一下要怎麼下這個標題吧 <(_ _)> 我現在想要寫一個ptt(bbs)的wraper 用ssh連線,現在還在很原始的階段,code在下面 當沒有綠色的部份(讓ssh直接寫到tty)時,bbs的操作是OK的 可是加上後,會在一個螢幕還沒畫完時就卡著 操作的指令還有用,可是畫面會很亂 不知到是ssh還是python被block, 還是? os:linux, python3.1.2 ---------------- bbs=['ssh', 'bbsu@ptt.cc'] import sys, tty, subprocess, threading #為了放進一頁的ptt Conn=subprocess.Popen(bbs, stdin=subprocess.PIPE, # stdout=subprocess.PIPE, stderr=subprocess.STDOUT) def reading(): while True: scr=Conn.stdout.read(1) drop=sys.stdout.buffer.write(scr) #DataIn=threading.Thread(target=reading) #DataIn.start() tty.setraw(1) while True: char=sys.stdin.buffer.read(1) drop=Conn.stdin.write(char) Conn.stdin.flush() -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.245.32